diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/xmppserver_listener.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/xmppserver_listener.lua b/net/xmppserver_listener.lua index 15ce0b23..cd9a3460 100644 --- a/net/xmppserver_listener.lua +++ b/net/xmppserver_listener.lua @@ -7,7 +7,7 @@ local s2s_new_incoming = require "core.s2smanager".new_incoming; local s2s_streamopened = require "core.s2smanager".streamopened; local s2s_streamclosed = require "core.s2smanager".streamclosed; local s2s_destroy_session = require "core.s2smanager".destroy_session; - +local s2s_attempt_connect = require "core.s2smanager".attempt_connection; local stream_callbacks = { streamopened = s2s_streamopened, streamclosed = s2s_streamclosed }; local connlisteners_register = require "net.connlisteners".register; @@ -109,10 +109,15 @@ function xmppserver.listener(conn, data) end end -function xmppserver.disconnect(conn) +function xmppserver.disconnect(conn, err) local session = sessions[conn]; if session then - (session.log or log)("info", "s2s disconnected: %s->%s", tostring(session.from_host), tostring(session.to_host)); + if err and err ~= "closed" and session.srv_hosts then + if s2s_attempt_connect(session, err) then + return; -- Session lives for now + end + end + (session.log or log)("info", "s2s disconnected: %s->%s (%s)", tostring(session.from_host), tostring(session.to_host), tostring(err)); s2s_destroy_session(session); sessions[conn] = nil; session = nil; |