Software /
code /
clix
Changeset
45:36f5bf718d3c
clix.lua: Close connection immediately rather than delaying if send buffer is empty (thanks Florob)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 14 Dec 2010 20:18:56 +0000 |
parents | 44:3c3cc6d75814 |
children | 46:b5d6e443e571 |
files | clix.lua |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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