From 1d9d763906b33bcdbb07837a533cab08a524c70b Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 2 Oct 2009 21:20:53 +0100 Subject: net.server: Fix missing concatenation operator in error message --- net/server.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/server.lua b/net/server.lua index 971ea553..a6c57e41 100644 --- a/net/server.lua +++ b/net/server.lua @@ -720,7 +720,7 @@ end removeserver = function( port ) local handler = _server[ port ] if not handler then - return nil, "no server found on port '" .. tostring( port ) "'" + return nil, "no server found on port '" .. tostring( port ) .. "'" end handler.close( ) _server[ port ] = nil -- cgit v1.2.3 From 26b86f46a9ccec536984e9d5b5e73dfad7d88cae Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 2 Oct 2009 21:23:32 +0100 Subject: mod_bosh: Fix for 'invalid key to next' error when 2 clients lose connection at the same time --- plugins/mod_bosh.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua index 743ebdef..4289628f 100644 --- a/plugins/mod_bosh.lua +++ b/plugins/mod_bosh.lua @@ -245,6 +245,7 @@ function stream_callbacks.handlestanza(request, stanza) end end +local dead_sessions = {}; function on_timer() -- log("debug", "Checking for requests soon to timeout..."); -- Identify requests timing out within the next few seconds @@ -261,18 +262,26 @@ function on_timer() end now = now - 3; + local n_dead_sessions = 0; for session, inactive_since in pairs(inactive_sessions) do if session.bosh_max_inactive then if now - inactive_since > session.bosh_max_inactive then (session.log or log)("debug", "BOSH client inactive too long, destroying session at %d", now); sessions[session.sid] = nil; inactive_sessions[session] = nil; - sm_destroy_session(session, "BOSH client silent for over "..session.bosh_max_inactive.." seconds"); + n_dead_sessions = n_dead_sessions + 1; + dead_sessions[n_dead_sessions] = session; end else inactive_sessions[session] = nil; end end + + for i=1,n_dead_sessions do + local session = dead_sessions[i]; + dead_sessions[i] = nil; + sm_destroy_session(session, "BOSH client silent for over "..session.bosh_max_inactive.." seconds"); + end end local ports = config.get(module.host, "core", "bosh_ports") or { 5280 }; -- cgit v1.2.3