From 91090e6deabe3aa47cdec89f9979991066e6ac07 Mon Sep 17 00:00:00 2001 From: Ryan Ward Date: Sun, 26 Jan 2020 09:54:33 -0500 Subject: [PATCH] bugs and some more testing general bug fixes --- .gitignore | 3 ++- multi/init.lua | 12 ++++++------ multi/integration/networkManager/clientSide.lua | 3 ++- multi/integration/networkManager/serverSide.lua | 7 +++++++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 5ad9bed..05d5033 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ Atlas Shrugged by Ayn Rand Audiobook-9s2qrEau63E.webm test.lua test.lua *.code-workspace -*.dat \ No newline at end of file +*.dat +multi\integration\networkManager \ No newline at end of file diff --git a/multi/init.lua b/multi/init.lua index 39a81b1..b35eb98 100644 --- a/multi/init.lua +++ b/multi/init.lua @@ -1786,16 +1786,16 @@ function multi.initThreads(justThreads) if not _ then threads[i].OnError:Fire(threads[i],ret) end - if coroutine.status(threads[i].thread)=="dead" then + if threads[i] and coroutine.status(threads[i].thread)=="dead" then threads[i].OnDeath:Fire(threads[i],"ended",ret,r1,r2,r3,r4,r5,r6) table.remove(threads,i) - elseif threads[i].task == "skip" then + elseif threads[i] and threads[i].task == "skip" then threads[i].pos = threads[i].pos + 1 if threads[i].count==threads[i].pos then threads[i].task = "" threads[i].__ready = true end - elseif threads[i].task == "hold" then --GOHERE + elseif threads[i] and threads[i].task == "hold" then --GOHERE t0,t1,t2,t3,t4,t5,t6 = threads[i].func() if t0 then if t0==multi.NIL then @@ -1804,12 +1804,12 @@ function multi.initThreads(justThreads) threads[i].task = "" threads[i].__ready = true end - elseif threads[i].task == "sleep" then + elseif threads[i] and threads[i].task == "sleep" then if clock() - threads[i].time>=threads[i].sec then threads[i].task = "" threads[i].__ready = true end - elseif threads[i].task == "holdF" then + elseif threads[i] and threads[i].task == "holdF" then t0,t1,t2,t3,t4,t5,t6 = threads[i].func() if t0 then threads[i].task = "" @@ -1820,7 +1820,7 @@ function multi.initThreads(justThreads) t0 = nil t1 = "TIMEOUT" end - elseif threads[i].task == "holdW" then + elseif threads[i] and threads[i].task == "holdW" then threads[i].pos = threads[i].pos + 1 t0,t1,t2,t3,t4,t5,t6 = threads[i].func() if t0 then diff --git a/multi/integration/networkManager/clientSide.lua b/multi/integration/networkManager/clientSide.lua index aad8d80..4e91615 100644 --- a/multi/integration/networkManager/clientSide.lua +++ b/multi/integration/networkManager/clientSide.lua @@ -1,7 +1,8 @@ return function(self,data) local cmd,data = data:match("!(.-)!(.*)") + --print(">",cmd,data) if cmd == "PONG" then - -- + self:send("!PONG!") elseif cmd == "CHANNEL" then -- elseif cmd == "RETURNS" then diff --git a/multi/integration/networkManager/serverSide.lua b/multi/integration/networkManager/serverSide.lua index 0237dab..4970142 100644 --- a/multi/integration/networkManager/serverSide.lua +++ b/multi/integration/networkManager/serverSide.lua @@ -5,11 +5,18 @@ return function(self,data,client) if cmd == "PING" then self:send(client,"!PONG!") elseif cmd == "N_THREAD" then + print(1) local dat = bin.new(data) + print(2) local t = dat:getBlock("t") + print(3) local ret = bin.new() + print(4) ret:addBlock{ID = t.id,rets = {t.func(unpack(t.args))}} + print(5) + print(client,"!RETURNS!"..ret:getData()) self:send(client,"!RETURNS!"..ret:getData()) + print(6) elseif cmd == "CHANNEL" then local dat = bin.new(data):getBlock("t")