Tue, 14 Dec 2010 20:18:56 +0000
clix.lua: Close connection immediately rather than delaying if send buffer is empty (thanks Florob)
clix.lua | file | annotate | diff | comparison | revisions |
--- a/clix.lua Wed Sep 15 16:54:21 2010 +0100 +++ b/clix.lua Tue Dec 14 20:18:56 2010 +0000 @@ -101,7 +101,7 @@ local _real_close = conn.close; function conn:close() conn:debug("Delaying close..."); - conn:hook("drained", function () + local function close_conn() local function do_close() if _real_close then conn:debug("Closing now..."); @@ -116,7 +116,12 @@ else do_close(); end - end); + end + if conn.conn:bufferlen() == 0 then + close_conn(); + else + conn:hook("drained", close_conn); + end end -- /COMPAT