Diff

mod_saslauth_muc/mod_saslauth_muc.lua @ 287:6144fe6161f1

mod_saslauth_muc: Improved timer handling.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 14 Dec 2010 00:03:24 +0500
parent 284:3b96bba9f7e5
child 305:4c3abf1a9b5a
line wrap: on
line diff
--- a/mod_saslauth_muc/mod_saslauth_muc.lua	Tue Dec 14 00:02:10 2010 +0500
+++ b/mod_saslauth_muc/mod_saslauth_muc.lua	Tue Dec 14 00:03:24 2010 +0500
@@ -42,8 +42,7 @@
 end
 
 -- Timer to clear SASL sessions
-timer.add_task(timeout, function()
-	local now = os_time();
+timer.add_task(timeout, function(now)
 	for room, handlers in pairs(_rooms) do
 		for jid, handler in pairs(handlers) do
 			if handler.timeout <= now then handlers[jid] = nil; end
@@ -52,6 +51,9 @@
 	end
 	return timeout;
 end);
+function module.unload()
+	timeout = nil; -- stop timer on unload
+end
 
 -- Stanza handlers
 module:hook("presence/full", function(event)