more #3 related stuff, this time adding the improvements to the KOS NEO version

This commit is contained in:
Izaya 2018-06-17 23:16:58 +10:00
parent ad3c6d8433
commit 3a769628e6
5 changed files with 14 additions and 9 deletions

View File

@ -5,6 +5,8 @@ echo miniprompt.lua
lua minify.lua miniprompt.lua mini-miniprompt.lua lua minify.lua miniprompt.lua mini-miniprompt.lua
echo fget.lua echo fget.lua
lua minify.lua fget.lua mini-fget.lua lua minify.lua fget.lua mini-fget.lua
echo ufs.lua
lua minify.lua ufs.lua mini-ufs.lua
echo init-wrapper.lua echo init-wrapper.lua
lua minify.lua init-wrapper.lua mini-init-wrapper.lua lua minify.lua init-wrapper.lua mini-init-wrapper.lua
echo microtel-3.lua echo microtel-3.lua

View File

@ -16,7 +16,7 @@ function read()
if tSignal[3] > 31 and tSignal[3] < 127 then if tSignal[3] > 31 and tSignal[3] < 127 then
write(string.char(tSignal[3])) write(string.char(tSignal[3]))
sBuffer = sBuffer .. string.char(tSignal[3]) sBuffer = sBuffer .. string.char(tSignal[3])
elseif tSignal[3] == 8 and tSignal[4] == 14 and S:len() > 0 then elseif tSignal[3] == 8 and tSignal[4] == 14 and sBuffer:len() > 0 then
write("\8 \8") write("\8 \8")
sBuffer = sBuffer:sub(1,-2) sBuffer = sBuffer:sub(1,-2)
end end

View File

@ -47,7 +47,7 @@ local listener = false
local dbug = false local dbug = false
local modems = {} local modems = {}
local port = 4096 local port = 4096
local retry = 30 local retry = 10
local route = true local route = true
--[[ --[[
@ -60,7 +60,7 @@ address {
]]-- ]]--
local sroutes = {} local sroutes = {}
local rcache = setmetatable({},{__index=sroutes}) local rcache = setmetatable({},{__index=sroutes})
local rctime = 30 local rctime = 15
--[[ --[[
packet queue format: packet queue format:

View File

@ -50,11 +50,13 @@ function net.usend(to,port,data,npID)
end end
function net.rsend(to,port,data) function net.rsend(to,port,data)
local pid = net.genPacketID() local pid, stime = net.genPacketID(), computer.uptime() + net.streamdelay
minitel.sendPacket(1,to,port,data,pid) computer.pushSignal("net_send",1,to,port,data,pid)
repeat repeat
_,rpid = svcpull("net_ack") _,rpid = svcpull("net_ack")
until rpid == pid until rpid == pid or computer.uptime() > stime
if not rpid then return false end
return true
end end
-- ordered packet delivery, layer 4? -- ordered packet delivery, layer 4?
@ -70,8 +72,9 @@ function net.send(to,port,ldata)
tdata = {ldata} tdata = {ldata}
end end
for k,v in ipairs(tdata) do for k,v in ipairs(tdata) do
net.rsend(to,port,v) if not net.rsend(to,port,v) then return false end
end end
return true
end end
-- socket stuff, layer 5? -- socket stuff, layer 5?

View File

@ -34,7 +34,7 @@ address {
]]-- ]]--
local sroutes = {} local sroutes = {}
local rcache = setmetatable({},{__index=sroutes}) local rcache = setmetatable({},{__index=sroutes})
local rctime = 30 local rctime = 15
--[[ --[[
packet queue format: packet queue format:
@ -51,7 +51,7 @@ local pqueue = {}
-- packet cache: [packet ID]=uptime -- packet cache: [packet ID]=uptime
local pcache = {} local pcache = {}
local pctime = 15 local pctime = 30
local function dprint(...) local function dprint(...)
if dbug then if dbug then