fixed cache clearing, some nil issues

This commit is contained in:
Izaya 2017-09-04 02:20:45 +10:00
parent 621cc397a2
commit f289516c9d
1 changed files with 9 additions and 8 deletions

View File

@ -43,18 +43,21 @@ spawn("copperd",function() print(pcall(function ()
pd.pt = 2 pd.pt = 2
pd.nid = src pd.nid = src
pd.lt = 0 pd.lt = 0
pd.msg = ""
ps[pd.pid] = pd ps[pd.pid] = pd
elseif pd.pt == 2 then elseif pd.pt == 2 then
ps[pd.pid] = nil ps[pd.pid] = nil
end end
end end
else else
if hops < 255 then
for k,v in ipairs(net.tm) do for k,v in ipairs(net.tm) do
v.broadcast(net.np,"copper",cdlib.encode(hops+1,src,dst,data)) v.broadcast(net.np,"copper",cdlib.encode(hops+1,src,dst,data))
end end
end end
end end
end end
end
for k,v in pairs(ps) do for k,v in pairs(ps) do
if v.lt < os.time()-1 then if v.lt < os.time()-1 then
for l,m in ipairs(net.tm) do for l,m in ipairs(net.tm) do
@ -68,7 +71,6 @@ spawn("copperd",function() print(pcall(function ()
ps[k] = nil ps[k] = nil
end end
end end
if #pt > 63 then
local cot = os.time() local cot = os.time()
for k,v in pairs(pt) do for k,v in pairs(pt) do
if v < cot-16 then if v < cot-16 then
@ -76,6 +78,5 @@ spawn("copperd",function() print(pcall(function ()
end end
end end
end end
end
end)) end) end)) end)
end end