Comparison

mod_smacks/mod_smacks.lua @ 623:c1f3958695ea

mod_smacks: If a resumed session still has a connection open, close that connection before resuming
author Matthew Wild <mwild1@gmail.com>
date Sat, 17 Mar 2012 15:53:45 +0000
parent 622:ce39df945de1
child 624:55a9d3c2f73b
comparison
equal deleted inserted replaced
622:ce39df945de1 623:c1f3958695ea
250 ); 250 );
251 elseif session.username == original_session.username 251 elseif session.username == original_session.username
252 and session.host == original_session.host then 252 and session.host == original_session.host then
253 session.log("debug", "mod_smacks resuming existing session..."); 253 session.log("debug", "mod_smacks resuming existing session...");
254 -- TODO: All this should move to sessionmanager (e.g. session:replace(new_session)) 254 -- TODO: All this should move to sessionmanager (e.g. session:replace(new_session))
255 if original_session.conn then
256 session.log("debug", "mod_smacks closing an old connection for this session");
257 local conn = original_session.conn;
258 require "net.connlisteners".get("xmppclient").associate_session(conn, nil);
259 conn:close();
260 end
255 original_session.ip = session.ip; 261 original_session.ip = session.ip;
256 original_session.conn = session.conn; 262 original_session.conn = session.conn;
257 original_session.send = session.send; 263 original_session.send = session.send;
258 original_session.stream = session.stream; 264 original_session.stream = session.stream;
259 original_session.secure = session.secure; 265 original_session.secure = session.secure;