Changeset

287:6144fe6161f1

mod_saslauth_muc: Improved timer handling.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 14 Dec 2010 00:03:24 +0500
parents 286:ca6199d73d68
children 288:9233d7ee3c09
files mod_saslauth_muc/mod_saslauth_muc.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
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)