bugfix and use timestamp in packet

This commit is contained in:
Mikayla Fischler 2022-04-23 20:46:01 -04:00
parent 852161317d
commit fa19af308d

View File

@ -35,7 +35,7 @@ function new_session(id, for_reactor, in_queue, out_queue)
last_rtt = 0, last_rtt = 0,
-- when to next retry one of these requests -- when to next retry one of these requests
periodics = { periodics = {
last_update = 0 last_update = 0,
keep_alive = 0 keep_alive = 0
}, },
retry_times = { retry_times = {
@ -45,6 +45,7 @@ function new_session(id, for_reactor, in_queue, out_queue)
}, },
-- session database -- session database
sDB = { sDB = {
last_status_update = 0,
control_state = false, control_state = false,
overridden = false, overridden = false,
degraded = false, degraded = false,
@ -200,7 +201,7 @@ function new_session(id, for_reactor, in_queue, out_queue)
elseif rplc_pkt.type == RPLC_TYPES.STATUS then elseif rplc_pkt.type == RPLC_TYPES.STATUS then
-- status packet received, update data -- status packet received, update data
if rplc_pkt.length >= 5 then if rplc_pkt.length >= 5 then
-- @todo [1] is timestamp, determine how this will be used (if at all) self.sDB.last_status_update = rplc_pkt.data[1]
self.sDB.control_state = rplc_pkt.data[2] self.sDB.control_state = rplc_pkt.data[2]
self.sDB.overridden = rplc_pkt.data[3] self.sDB.overridden = rplc_pkt.data[3]
self.sDB.degraded = rplc_pkt.data[4] self.sDB.degraded = rplc_pkt.data[4]