code cleanup and bugfixes
This commit is contained in:
@@ -14,6 +14,10 @@ local println = util.println
|
||||
local print_ts = util.print_ts
|
||||
local println_ts = util.println_ts
|
||||
|
||||
local PERIODICS = {
|
||||
KEEP_ALIVE = 2.0
|
||||
}
|
||||
|
||||
rtu.new_session = function (id, in_queue, out_queue)
|
||||
local log_header = "rtu_session(" .. id .. "): "
|
||||
|
||||
@@ -97,7 +101,6 @@ rtu.new_session = function (id, in_queue, out_queue)
|
||||
-- RTU unit advertisement
|
||||
for i = 1, packet.length do
|
||||
local unit = packet.data[i]
|
||||
unit
|
||||
end
|
||||
else
|
||||
log.debug(log_header .. "handler received unsupported SCADA_MGMT packet type " .. pkt.type)
|
||||
|
||||
@@ -97,7 +97,7 @@ local function _free_closed(sessions)
|
||||
for i = 1, #sessions do
|
||||
local session = sessions[i]
|
||||
if session ~= nil then
|
||||
if sessions[i].open then
|
||||
if session.open then
|
||||
if sessions[move_to] == nil then
|
||||
sessions[move_to] = session
|
||||
sessions[i] = nil
|
||||
|
||||
@@ -45,18 +45,18 @@ unit.new = function (for_reactor)
|
||||
table.insert(self.turbines, turbine)
|
||||
end
|
||||
|
||||
public.add_boiler = function (turbine)
|
||||
public.add_boiler = function (boiler)
|
||||
table.insert(self.boilers, boiler)
|
||||
end
|
||||
|
||||
public.add_redstone = function (field, accessor)
|
||||
-- ensure field exists
|
||||
if redstone[field] == nil then
|
||||
redstone[field] = {}
|
||||
if self.redstone[field] == nil then
|
||||
self.redstone[field] = {}
|
||||
end
|
||||
|
||||
-- insert into list
|
||||
table.insert(redstone[field], accessor)
|
||||
table.insert(self.redstone[field], accessor)
|
||||
end
|
||||
|
||||
local _update_annunciator = function ()
|
||||
|
||||
Reference in New Issue
Block a user