diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-10-02 21:24:16 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-10-02 21:24:16 +0100 |
commit | f816a78cb14388155935520d7c459deecc0e9ec4 (patch) | |
tree | a23c515ac78b34210ad704570c27b31317ec90d7 | |
parent | 993f73525583958fc68e23aba9255b2d2efaea4c (diff) | |
parent | 26b86f46a9ccec536984e9d5b5e73dfad7d88cae (diff) | |
download | prosody-f816a78cb14388155935520d7c459deecc0e9ec4.tar.gz prosody-f816a78cb14388155935520d7c459deecc0e9ec4.zip |
Merge with 0.5
-rw-r--r-- | net/server.lua | 2 | ||||
-rw-r--r-- | plugins/mod_bosh.lua | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/net/server.lua b/net/server.lua index 66272ccc..eb032c17 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
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua index e310be28..0dd4a192 100644 --- a/plugins/mod_bosh.lua +++ b/plugins/mod_bosh.lua @@ -258,6 +258,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 @@ -274,18 +275,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 = module:get_option("bosh_ports") or { 5280 }; |