Changeset

1254:b0136968bef1

mod_component_roundrobin: Make sure we don’t try to use destroyed sessions.
author Waqas Hussain <waqas20@gmail.com>
date Thu, 19 Dec 2013 08:54:33 -0500
parents 1253:19cf607111fb
children 1255:3c35283b6780
files mod_component_roundrobin/mod_component_roundrobin.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_component_roundrobin/mod_component_roundrobin.lua	Thu Dec 19 12:59:32 2013 +0100
+++ b/mod_component_roundrobin/mod_component_roundrobin.lua	Thu Dec 19 08:54:33 2013 -0500
@@ -21,14 +21,15 @@
 
 local sessions = {};
 
+local last_session;
 local function on_destroy(session, err)
 	if sessions[session] then
+		if last_session == session then last_session = nil; end
 		sessions[session] = nil;
 		session.on_destroy = nil;
 	end
 end
 
-local last_session;
 local function handle_stanza(event)
 	local stanza = event.stanza;
 	if next(sessions) then