From b7d4468cea9f3618252dd43f26f081c46ae92b90 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Fri, 25 Aug 2023 21:42:35 -0400 Subject: [PATCH] #327 close connections on timeout --- reactor-plc/startup.lua | 2 +- reactor-plc/threads.lua | 4 ++-- rtu/startup.lua | 2 +- rtu/threads.lua | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/reactor-plc/startup.lua b/reactor-plc/startup.lua index 66435d9..2c58637 100644 --- a/reactor-plc/startup.lua +++ b/reactor-plc/startup.lua @@ -19,7 +19,7 @@ local plc = require("reactor-plc.plc") local renderer = require("reactor-plc.renderer") local threads = require("reactor-plc.threads") -local R_PLC_VERSION = "v1.5.6" +local R_PLC_VERSION = "v1.5.7" local println = util.println local println_ts = util.println_ts diff --git a/reactor-plc/threads.lua b/reactor-plc/threads.lua index 12ae75a..3b06904 100644 --- a/reactor-plc/threads.lua +++ b/reactor-plc/threads.lua @@ -154,8 +154,8 @@ function threads.thread__main(smem, init) smem.q.mq_comms_rx.push_packet(packet) end elseif event == "timer" and networked and plc_state.init_ok and conn_watchdog.is_timer(param1) then - -- haven't heard from server recently? shutdown reactor - plc_comms.unlink() + -- haven't heard from server recently? close connection and shutdown reactor + plc_comms.close() smem.q.mq_rps.push_command(MQ__RPS_CMD.TRIP_TIMEOUT) elseif event == "timer" then -- notify timer callback dispatcher if no other timer case claimed this event diff --git a/rtu/startup.lua b/rtu/startup.lua index acec142..1663bce 100644 --- a/rtu/startup.lua +++ b/rtu/startup.lua @@ -31,7 +31,7 @@ local sna_rtu = require("rtu.dev.sna_rtu") local sps_rtu = require("rtu.dev.sps_rtu") local turbinev_rtu = require("rtu.dev.turbinev_rtu") -local RTU_VERSION = "v1.6.0" +local RTU_VERSION = "v1.6.1" local RTU_UNIT_TYPE = types.RTU_UNIT_TYPE local RTU_UNIT_HW_STATE = databus.RTU_UNIT_HW_STATE diff --git a/rtu/threads.lua b/rtu/threads.lua index ee8e270..6ac05bd 100644 --- a/rtu/threads.lua +++ b/rtu/threads.lua @@ -93,8 +93,8 @@ function threads.thread__main(smem) smem.q.mq_comms.push_packet(packet) end elseif event == "timer" and conn_watchdog.is_timer(param1) then - -- haven't heard from server recently? unlink - rtu_comms.unlink(rtu_state) + -- haven't heard from server recently? close connection + rtu_comms.close(rtu_state) elseif event == "timer" then -- notify timer callback dispatcher if no other timer case claimed this event tcd.handle(param1)