Mercurial > prosody-hg
diff net/xmppclient_listener.lua @ 123:ebd65feb188c
Fix for not destroying sessions when connection closed.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 23 Oct 2008 16:07:40 +0100 |
| parents | ba08b8a4eeef |
| children | 4c0dcd245d34 |
line wrap: on
line diff
--- a/net/xmppclient_listener.lua Thu Oct 23 14:39:42 2008 +0100 +++ b/net/xmppclient_listener.lua Thu Oct 23 16:07:40 2008 +0100 @@ -69,6 +69,19 @@ end function xmppclient.disconnect(conn) + local session = sessions[conn]; + if session then + if session.last_presence and session.last_presence.attr.type ~= "unavailable" then + local pres = st.presence{ type = "unavailable" }; + if err == "closed" then err = "connection closed"; end + pres:tag("status"):text("Disconnected: "..err); + session.stanza_dispatch(pres); + end + sm_destroy_session(session); + sessions[conn] = nil; + session = nil; + collectgarbage("collect"); + end end connlisteners_register("xmppclient", xmppclient);
