1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-12-26 02:48:06 +11: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"] = {
desc = "Line-terminal for MUDs & such",
v = 0,
v = 1,
deps = {
"neo",
"zzz-license-pd"

View File

@ -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
else
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