From 0b45d1f97687ccd7cdcc82fa53530b6dacd6a4b8 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 2 Apr 2011 17:28:27 +0000 Subject: fixed tcpserver diff --git a/mode-tcpserver.lua b/mode-tcpserver.lua index f1f3e92..671ba09 100644 --- a/mode-tcpserver.lua +++ b/mode-tcpserver.lua @@ -119,7 +119,7 @@ function main_loop(opt) local return_value = 0 while return_value == 0 do - local readable, _, err = socket.select({ sig , cmdfd , server , unpack(clients) }, clients_get_writeables()) + local readable, writeable, err = socket.select({ sig , cmdfd , server , unpack(clients) }, clients_get_writeables()) if(err) then log.printf(log.ERROR, "select returned with error: %s", err) return_value = -1 @@ -149,6 +149,14 @@ function main_loop(opt) end end end + for _, output in ipairs(writeable) do + 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 -- cgit v0.10.2