Diff

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
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Mon Mar 05 16:53:30 2012 +0000
+++ b/mod_smacks/mod_smacks.lua	Sat Mar 17 15:53:45 2012 +0000
@@ -252,6 +252,12 @@
 	and session.host == original_session.host then
 		session.log("debug", "mod_smacks resuming existing session...");
 		-- TODO: All this should move to sessionmanager (e.g. session:replace(new_session))
+		if original_session.conn then
+			session.log("debug", "mod_smacks closing an old connection for this session");
+			local conn = original_session.conn;
+			require "net.connlisteners".get("xmppclient").associate_session(conn, nil);
+			conn:close();
+		end
 		original_session.ip = session.ip;
 		original_session.conn = session.conn;
 		original_session.send = session.send;