Comparison

net/xmppclient_listener.lua @ 1422:db9cb1f24f38

xmppclient_listener: Pass session close reason to destroy_session (to be used in unavailable presence)
author Matthew Wild <mwild1@gmail.com>
date Fri, 26 Jun 2009 06:32:45 +0100
parent 1255:a25b12c105bb
child 1490:b5c59667a04c
comparison
equal deleted inserted replaced
1421:7dafb3bae02b 1422:db9cb1f24f38
93 end 93 end
94 end 94 end
95 end 95 end
96 session.send("</stream:stream>"); 96 session.send("</stream:stream>");
97 session.conn.close(); 97 session.conn.close();
98 xmppclient.disconnect(session.conn, "stream error"); 98 xmppclient.disconnect(session.conn, reason.condition or reason or "session closed");
99 end 99 end
100 end 100 end
101 101
102 102
103 -- End of session methods -- 103 -- End of session methods --
134 134
135 function xmppclient.disconnect(conn, err) 135 function xmppclient.disconnect(conn, err)
136 local session = sessions[conn]; 136 local session = sessions[conn];
137 if session then 137 if session then
138 (session.log or log)("info", "Client disconnected: %s", err); 138 (session.log or log)("info", "Client disconnected: %s", err);
139 sm_destroy_session(session); 139 sm_destroy_session(session, err);
140 sessions[conn] = nil; 140 sessions[conn] = nil;
141 session = nil; 141 session = nil;
142 collectgarbage("collect"); 142 collectgarbage("collect");
143 end 143 end
144 end 144 end