From b28020144650618577607ff0dbe6f3bc86f5d645 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Mon, 2 May 2022 11:44:10 -0400 Subject: [PATCH] #41 cancel session watchdog timer --- scada-common/util.lua | 6 ++++++ supervisor/session/plc.lua | 1 + 2 files changed, 7 insertions(+) diff --git a/scada-common/util.lua b/scada-common/util.lua index 36761fd..bcab1b5 100644 --- a/scada-common/util.lua +++ b/scada-common/util.lua @@ -81,6 +81,12 @@ function new_watchdog(timeout) self._wd_timer = os.startTimer(self._timeout) end + local cancel = function () + if self._wd_timer ~= nil then + os.cancelTimer(self._wd_timer) + end + end + return { get_timer = get_timer, feed = feed diff --git a/supervisor/session/plc.lua b/supervisor/session/plc.lua index 810d8df..6f8cb5f 100644 --- a/supervisor/session/plc.lua +++ b/supervisor/session/plc.lua @@ -365,6 +365,7 @@ function new_session(id, for_reactor, in_queue, out_queue) -- close the connection local close = function () + self.plc_conn_watchdod.cancel() self.connected = false _send_mgmt(SCADA_MGMT_TYPES.CLOSE, {}) end