#635 comms optimizations

This commit is contained in:
Mikayla
2025-11-10 23:00:52 +00:00
parent fb102502dd
commit 2e01b478f1
15 changed files with 90 additions and 134 deletions

View File

@@ -923,14 +923,10 @@ function plc.comms(version, nic, reactor, rps, conn_watchdog)
local pkt = nil
if s_pkt then
-- get as RPLC packet
if s_pkt.protocol() == PROTOCOL.RPLC then
local rplc_pkt = comms.rplc_packet()
if rplc_pkt.decode(s_pkt) then pkt = rplc_pkt.get() end
-- get as SCADA management packet
pkt = comms.rplc_packet().decode(s_pkt)
elseif s_pkt.protocol() == PROTOCOL.SCADA_MGMT then
local mgmt_pkt = comms.mgmt_packet()
if mgmt_pkt.decode(s_pkt) then pkt = mgmt_pkt.get() end
pkt = comms.mgmt_packet().decode(s_pkt)
else
log.debug("unsupported packet type " .. s_pkt.protocol(), true)
end