#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

@@ -326,10 +326,10 @@ function check.receive_sv(side, sender, reply_to, message, distance)
local s_pkt = self.nic.receive(side, sender, reply_to, message, distance)
if s_pkt and s_pkt.protocol() == PROTOCOL.SCADA_MGMT then
local mgmt_pkt = comms.mgmt_packet()
if mgmt_pkt.decode(s_pkt) then
local pkt = comms.mgmt_packet().decode(s_pkt)
if pkt then
tcd.abort(handle_timeout)
handle_packet(mgmt_pkt.get())
handle_packet(pkt)
end
end
end

View File

@@ -425,18 +425,10 @@ function rtu.comms(version, nic, conn_watchdog)
local pkt = nil
if s_pkt then
-- get as MODBUS TCP packet
if s_pkt.protocol() == PROTOCOL.MODBUS_TCP then
local m_pkt = comms.modbus_packet()
if m_pkt.decode(s_pkt) then
pkt = m_pkt.get()
end
-- get as SCADA management packet
pkt = comms.modbus_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("illegal packet type " .. s_pkt.protocol(), true)
end

View File

@@ -21,7 +21,7 @@ local rtu = require("rtu.rtu")
local threads = require("rtu.threads")
local uinit = require("rtu.uinit")
local RTU_VERSION = "v1.13.0"
local RTU_VERSION = "v1.13.1"
local println = util.println
local println_ts = util.println_ts