99 |
99 |
100 -- COMPAT: Tigase discards stanzas sent at the same time as </stream:stream> |
100 -- COMPAT: Tigase discards stanzas sent at the same time as </stream:stream> |
101 local _real_close = conn.close; |
101 local _real_close = conn.close; |
102 function conn:close() |
102 function conn:close() |
103 conn:debug("Delaying close..."); |
103 conn:debug("Delaying close..."); |
104 conn:hook("drained", function () |
104 local function close_conn() |
105 local function do_close() |
105 local function do_close() |
106 if _real_close then |
106 if _real_close then |
107 conn:debug("Closing now..."); |
107 conn:debug("Closing now..."); |
108 local close = _real_close; |
108 local close = _real_close; |
109 _real_close = nil; |
109 _real_close = nil; |