#32 new threaded PLC code

This commit is contained in:
Mikayla Fischler
2022-04-27 12:21:10 -04:00
parent f7f723829c
commit 68011d6734
7 changed files with 210 additions and 132 deletions

View File

@@ -330,7 +330,7 @@ function new_session(id, for_reactor, in_queue, out_queue)
-- handle queue --
------------------
if not self.in_q.empty() then
if self.in_q.ready() then
-- get a new message to process
local message = self.in_q.pop()

View File

@@ -130,7 +130,7 @@ local function _iterate(sessions)
if ok then
-- send packets in out queue
-- @todo handle commands if that's being used too
while not session.out_queue.empty() do
while session.out_queue.ready() do
local msg = session.out_queue.pop()
if msg.qtype == mqueue.TYPE.PACKET then
self.modem.transmit(session.r_port, session.l_port, msg.message.raw_sendable())