diff options
-rw-r--r-- | rhnop-server/tcpserver.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rhnop-server/tcpserver.lua b/rhnop-server/tcpserver.lua index c035ba4..bb7fcc5 100644 --- a/rhnop-server/tcpserver.lua +++ b/rhnop-server/tcpserver.lua @@ -116,8 +116,12 @@ function main_loop() end for _, output in ipairs(writeables) do - local ret = assert(output.hdl:send(output.buffer)) - output.buffer = string.sub(output.buffer, ret+1) + local ret = output.hdl:send(output.buffer) + if(ret == nil) then + remove_client(output) + else + output.buffer = string.sub(output.buffer, ret+1) + end end end end |