mirror of
https://github.com/20kdc/OC-KittenOS.git
synced 2024-11-27 04:48:05 +11:00
Update KMT to v1: be faster at reading
This commit is contained in:
parent
13d3abfd26
commit
324ed86335
@ -91,7 +91,7 @@ return {
|
||||
},
|
||||
["app-kmt"] = {
|
||||
desc = "Line-terminal for MUDs & such",
|
||||
v = 0,
|
||||
v = 1,
|
||||
deps = {
|
||||
"neo",
|
||||
"zzz-license-pd"
|
||||
|
@ -113,7 +113,7 @@ while true do
|
||||
local e = {coroutine.yield()}
|
||||
if e[1] == "k.timer" then
|
||||
while true do
|
||||
local b, e = tcp.read(1)
|
||||
local b, e = tcp.read(neo.readBufSize)
|
||||
if not b then
|
||||
if e then
|
||||
incoming(":Warning: " .. e)
|
||||
@ -123,12 +123,16 @@ while true do
|
||||
break
|
||||
elseif b == "" then
|
||||
break
|
||||
elseif b ~= "\r" then
|
||||
if b == "\n" then
|
||||
incoming("<" .. tcpBuf)
|
||||
tcpBuf = ""
|
||||
else
|
||||
tcpBuf = tcpBuf .. b
|
||||
tcpBuf = tcpBuf .. b:gsub("\r", "")
|
||||
while true do
|
||||
local nlp = tcpBuf:find("\n")
|
||||
if nlp then
|
||||
incoming("<" .. tcpBuf:sub(1, nlp - 1))
|
||||
tcpBuf = tcpBuf:sub(nlp + 1)
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user