#65 safe concat where appropriate

This commit is contained in:
Mikayla Fischler
2022-06-05 11:16:25 -04:00
parent 5068e47590
commit f0c97e8b70
12 changed files with 40 additions and 39 deletions

View File

@@ -391,8 +391,8 @@ function plc.new_session(id, for_reactor, in_queue, out_queue)
log.warning(log_header .. "PLC KEEP_ALIVE round trip time > 500ms (" .. self.last_rtt .. "ms)")
end
-- log.debug(log_header .. "PLC RTT = ".. self.last_rtt .. "ms")
-- log.debug(log_header .. "PLC TT = ".. (srv_now - plc_send) .. "ms")
-- log.debug(log_header .. "PLC RTT = " .. self.last_rtt .. "ms")
-- log.debug(log_header .. "PLC TT = " .. (srv_now - plc_send) .. "ms")
else
log.debug(log_header .. "SCADA keep alive packet length mismatch")
end

View File

@@ -235,8 +235,8 @@ function rtu.new_session(id, in_queue, out_queue, advertisement)
log.warning(log_header .. "RTU KEEP_ALIVE round trip time > 500ms (" .. self.last_rtt .. "ms)")
end
-- log.debug(log_header .. "RTU RTT = ".. self.last_rtt .. "ms")
-- log.debug(log_header .. "RTU TT = ".. (srv_now - rtu_send) .. "ms")
-- log.debug(log_header .. "RTU RTT = " .. self.last_rtt .. "ms")
-- log.debug(log_header .. "RTU TT = " .. (srv_now - rtu_send) .. "ms")
else
log.debug(log_header .. "SCADA keep alive packet length mismatch")
end

View File

@@ -104,7 +104,7 @@ function redstone.new(session_id, unit_id, advert, out_queue)
table.insert(self.io_list.analog_out, channel)
else
-- should be unreachable code, we already validated channels
log.error(log_tag .. "failed to identify advertisement channel IO mode (" .. channel .. ")", true)
log.error(util.c(log_tag, "failed to identify advertisement channel IO mode (", channel, ")"), true)
return nil
end
@@ -212,8 +212,8 @@ function redstone.new(session_id, unit_id, advert, out_queue)
break
end
end
elseif mode ~= nil then
log.debug(log_tag .. "attemted write to non D/O or A/O mode " .. mode)
else
log.debug(util.c(log_tag, "attemted write to non D/O or A/O mode ", mode))
end
end
end

View File

@@ -237,7 +237,7 @@ function turbinev.new(session_id, unit_id, advert, out_queue)
elseif cmd == TBV_RTU_S_CMDS.DEC_DUMP_MODE then
_dec_dump_mode()
else
log.debug(log_tag .. "unrecognized in_q command " .. util.strval(cmd))
log.debug(util.c(log_tag, "unrecognized in_q command ", cmd))
end
elseif msg.qtype == mqueue.TYPE.DATA then
-- instruction with body
@@ -245,7 +245,7 @@ function turbinev.new(session_id, unit_id, advert, out_queue)
if cmd.key == TBV_RTU_S_DATA.SET_DUMP_MODE then
_set_dump_mode(cmd.val)
else
log.debug(log_tag .. "unrecognized in_q data " .. util.strval(cmd.key))
log.debug(util.c(log_tag, "unrecognized in_q data ", cmd.key))
end
end
end

View File

@@ -187,11 +187,11 @@ function supervisor.comms(version, num_reactors, modem, dev_listen, coord_listen
local plc_id = svsessions.establish_plc_session(l_port, r_port, packet.data[1], packet.data[2])
if plc_id == false then
-- reactor already has a PLC assigned
log.debug("PLC_LNK: assignment collision with reactor " .. packet.data[1])
log.debug(util.c("PLC_LNK: assignment collision with reactor ", packet.data[1]))
_send_plc_linking(next_seq_id, r_port, { RPLC_LINKING.COLLISION })
else
-- got an ID; assigned to a reactor successfully
println("connected to reactor " .. packet.data[1] .. " PLC (" .. packet.data[2] .. ") [:" .. r_port .. "]")
println(util.c("connected to reactor ", packet.data[1], " PLC (", packet.data[2], ") [:", r_port, "]"))
log.debug("PLC_LNK: allowed for device at " .. r_port)
_send_plc_linking(next_seq_id, r_port, { RPLC_LINKING.ALLOW })
end
@@ -215,7 +215,7 @@ function supervisor.comms(version, num_reactors, modem, dev_listen, coord_listen
elseif packet.type == SCADA_MGMT_TYPES.RTU_ADVERT then
if packet.length >= 1 then
-- this is an RTU advertisement for a new session
println("connected to RTU (" .. packet.data[1] .. ") [:" .. r_port .. "]")
println(util.c("connected to RTU (", packet.data[1], ") [:", r_port, "]"))
svsessions.establish_rtu_session(l_port, r_port, packet.data)
@@ -244,7 +244,7 @@ function supervisor.comms(version, num_reactors, modem, dev_listen, coord_listen
log.debug("illegal packet type " .. protocol .. " on coordinator listening channel")
end
else
log.error("received packet on unused channel " .. l_port, true)
log.warning("received packet on unused channel " .. l_port)
end
end
end