1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2025-04-06 03:38:40 +10:00

Update KMT to v1: be faster at reading

This commit is contained in:
20kdc 2018-07-28 17:20:43 +01:00
parent 13d3abfd26
commit 324ed86335
2 changed files with 12 additions and 8 deletions

View File

@ -91,7 +91,7 @@ return {
}, },
["app-kmt"] = { ["app-kmt"] = {
desc = "Line-terminal for MUDs & such", desc = "Line-terminal for MUDs & such",
v = 0, v = 1,
deps = { deps = {
"neo", "neo",
"zzz-license-pd" "zzz-license-pd"

View File

@ -113,7 +113,7 @@ while true do
local e = {coroutine.yield()} local e = {coroutine.yield()}
if e[1] == "k.timer" then if e[1] == "k.timer" then
while true do while true do
local b, e = tcp.read(1) local b, e = tcp.read(neo.readBufSize)
if not b then if not b then
if e then if e then
incoming(":Warning: " .. e) incoming(":Warning: " .. e)
@ -123,12 +123,16 @@ while true do
break break
elseif b == "" then elseif b == "" then
break break
elseif b ~= "\r" then else
if b == "\n" then tcpBuf = tcpBuf .. b:gsub("\r", "")
incoming("<" .. tcpBuf) while true do
tcpBuf = "" local nlp = tcpBuf:find("\n")
else if nlp then
tcpBuf = tcpBuf .. b incoming("<" .. tcpBuf:sub(1, nlp - 1))
tcpBuf = tcpBuf:sub(nlp + 1)
else
break
end
end end
end end
end end