#350 handle RPS_DISABLE ack packet on supervisor

This commit is contained in:
Mikayla 2023-10-04 21:28:14 +00:00
parent 24d190921d
commit 26dc6ff6d1
2 changed files with 12 additions and 3 deletions

View File

@ -390,6 +390,15 @@ function plc.new_session(id, s_addr, reactor_id, in_queue, out_queue, timeout, f
cmd = UNIT_COMMAND.START, cmd = UNIT_COMMAND.START,
ack = ack ack = ack
}) })
elseif pkt.type == RPLC_TYPE.RPS_DISABLE then
-- disable acknowledgement
local ack = _get_ack(pkt)
if ack then
self.acks.disable = true
self.sDB.control_state = false
elseif ack == false then
log.debug(log_header .. "disable failed!")
end
elseif pkt.type == RPLC_TYPE.RPS_SCRAM then elseif pkt.type == RPLC_TYPE.RPS_SCRAM then
-- manual SCRAM acknowledgement -- manual SCRAM acknowledgement
local ack = _get_ack(pkt) local ack = _get_ack(pkt)
@ -791,7 +800,7 @@ function plc.new_session(id, s_addr, reactor_id, in_queue, out_queue, timeout, f
-- reactor disable request retry -- reactor disable request retry
if not self.acks.disable then if not self.acks.disable then
if rtimes.disable_req - util.time() <= 0 then if rtimes.disable_req - util.time() <= 0 then
_send(RPLC_TYPE.RPS_DISABLE, {}) _send(RPLC_TYPE.RPS_DISABLE, {})
rtimes.disable_req = util.time() + RETRY_PERIOD rtimes.disable_req = util.time() + RETRY_PERIOD
end end
@ -800,7 +809,7 @@ function plc.new_session(id, s_addr, reactor_id, in_queue, out_queue, timeout, f
-- SCRAM request retry -- SCRAM request retry
if not self.acks.scram then if not self.acks.scram then
if rtimes.scram_req - util.time() <= 0 then if rtimes.scram_req - util.time() <= 0 then
_send(RPLC_TYPE.RPS_SCRAM, {}) _send(RPLC_TYPE.RPS_SCRAM, {})
rtimes.scram_req = util.time() + RETRY_PERIOD rtimes.scram_req = util.time() + RETRY_PERIOD
end end

View File

@ -21,7 +21,7 @@ local supervisor = require("supervisor.supervisor")
local svsessions = require("supervisor.session.svsessions") local svsessions = require("supervisor.session.svsessions")
local SUPERVISOR_VERSION = "v1.0.7" local SUPERVISOR_VERSION = "v1.0.8"
local println = util.println local println = util.println
local println_ts = util.println_ts local println_ts = util.println_ts