From 9aaf884f061bbb95302ab124989857be47eefe5d Mon Sep 17 00:00:00 2001 From: Izaya Date: Wed, 4 Apr 2018 13:47:18 +1000 Subject: [PATCH] cleanups and reorganisation --- KittenOS/apps/svc-minitel.lua | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/KittenOS/apps/svc-minitel.lua b/KittenOS/apps/svc-minitel.lua index 99bc2ef..2725575 100644 --- a/KittenOS/apps/svc-minitel.lua +++ b/KittenOS/apps/svc-minitel.lua @@ -199,19 +199,7 @@ local function processPacket(_,localModem,from,pport,_,packetID,packetType,dest, end end -listeners["modem_message"]=processPacket event.listen("modem_message",processPacket) -print("Started packet listening daemon: "..tostring(processPacket)) - -local function queuePacket(ptype,to,vport,data,npID) - npID = npID or genPacketID() - pqueue[npID] = {ptype,to,vport,data,0,0} - dprint(npID,table.unpack(pqueue[npID])) -end - -listeners["net_send"]=queuePacket -event.listen("net_send",queuePacket) -print("Started packet queueing daemon: "..tostring(queuePacket)) local function packetPusher() for k,v in pairs(pqueue) do @@ -228,11 +216,12 @@ local function packetPusher() end end -timers[#timers+1]=event.timer(0,packetPusher,math.huge) -print("Started packet pusher: "..tostring(timers[#timers])) - -listeners["net_ack"]=dprint -event.listen("net_ack",dprint) +local function queuePacket(ptype,to,vport,data,npID) + npID = npID or genPacketID() + pqueue[npID] = {ptype,to,vport,data,0,0} + dprint(npID,table.unpack(pqueue[npID])) + packetPusher() +end -- More KOS NEO stuff