From 12e69640651233c81d34938f49052f569f60676d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 28 Dec 2012 12:47:44 +0000 Subject: mod_s2s: Remove connection from sessions table as soon as we learn it is disconnected. Fixes a connection/session leak. --- plugins/mod_s2s/mod_s2s.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua index 098a74bd..788a64af 100644 --- a/plugins/mod_s2s/mod_s2s.lua +++ b/plugins/mod_s2s/mod_s2s.lua @@ -485,6 +485,7 @@ end function listener.ondisconnect(conn, err) local session = sessions[conn]; if session then + sessions[conn] = nil; if err and session.direction == "outgoing" and session.notopen then (session.log or log)("debug", "s2s connection attempt failed: %s", err); if s2sout.attempt_connection(session, err) then @@ -494,7 +495,6 @@ function listener.ondisconnect(conn, err) end (session.log or log)("debug", "s2s disconnected: %s->%s (%s)", tostring(session.from_host), tostring(session.to_host), tostring(err or "connection closed")); s2s_destroy_session(session, err); - sessions[conn] = nil; end end -- cgit v1.2.3