#636 close connections on nic switch
This commit is contained in:
@@ -250,7 +250,10 @@ function coordinator.comms(version, nic, wl_nic, sv_watchdog)
|
||||
|
||||
-- switch the current active NIC
|
||||
---@param act_nic nic
|
||||
function public.switch_nic(act_nic) nic = act_nic end
|
||||
function public.switch_nic(act_nic)
|
||||
public.close()
|
||||
nic = act_nic
|
||||
end
|
||||
|
||||
-- try to connect to the supervisor if not already linked
|
||||
---@param abort boolean? true to print out cancel info if not linked (use on program terminate)
|
||||
|
||||
@@ -830,7 +830,10 @@ function plc.comms(version, nic, reactor, rps, conn_watchdog)
|
||||
|
||||
-- switch the current active NIC
|
||||
---@param act_nic nic
|
||||
function public.switch_nic(act_nic) nic = act_nic end
|
||||
function public.switch_nic(act_nic)
|
||||
public.close()
|
||||
nic = act_nic
|
||||
end
|
||||
|
||||
-- reconnect a newly connected reactor
|
||||
---@param new_reactor table
|
||||
|
||||
@@ -136,7 +136,7 @@ function backplane.attach(type, device, iface, print_no_fp)
|
||||
-- switch back to preferred wired
|
||||
_bp.act_nic = wd_nic
|
||||
|
||||
comms.switch_nic(_bp.act_nic)
|
||||
comms.switch_nic(_bp.act_nic, _bp.smem.rtu_state)
|
||||
log.info("BKPLN: switched comms to wired modem (preferred)")
|
||||
end
|
||||
elseif wl_nic and (not wl_nic.is_connected()) and m_is_wl then
|
||||
@@ -152,7 +152,7 @@ function backplane.attach(type, device, iface, print_no_fp)
|
||||
-- switch back to preferred wireless
|
||||
_bp.act_nic = wl_nic
|
||||
|
||||
comms.switch_nic(_bp.act_nic)
|
||||
comms.switch_nic(_bp.act_nic, _bp.smem.rtu_state)
|
||||
log.info("BKPLN: switched comms to wireless modem (preferred)")
|
||||
end
|
||||
elseif wl_nic and m_is_wl then
|
||||
@@ -227,14 +227,14 @@ function backplane.detach(type, device, iface, print_no_fp)
|
||||
elseif wd_nic and wd_nic.is_connected() then
|
||||
_bp.act_nic = wd_nic
|
||||
|
||||
comms.switch_nic(_bp.act_nic)
|
||||
comms.switch_nic(_bp.act_nic, _bp.smem.rtu_state)
|
||||
log.info("BKPLN: switched comms to wired modem")
|
||||
end
|
||||
elseif wl_nic and wl_nic.is_connected() then
|
||||
-- wired active disconnected, wireless available
|
||||
_bp.act_nic = wl_nic
|
||||
|
||||
comms.switch_nic(_bp.act_nic)
|
||||
comms.switch_nic(_bp.act_nic, _bp.smem.rtu_state)
|
||||
log.info("BKPLN: switched comms to wireless modem")
|
||||
else
|
||||
-- wired active disconnected, wireless unavailable
|
||||
|
||||
@@ -359,7 +359,11 @@ function rtu.comms(version, nic, conn_watchdog)
|
||||
|
||||
-- switch the current active NIC
|
||||
---@param act_nic nic
|
||||
function public.switch_nic(act_nic) nic = act_nic end
|
||||
---@param rtu_state rtu_state
|
||||
function public.switch_nic(act_nic, rtu_state)
|
||||
public.close(rtu_state)
|
||||
nic = act_nic
|
||||
end
|
||||
|
||||
-- unlink from the server
|
||||
---@param rtu_state rtu_state
|
||||
|
||||
Reference in New Issue
Block a user