Software /
code /
prosody
Comparison
net/xmppserver_listener.lua @ 434:0d7ba3742f7a
(Basic) IDNA and SRV fallback support
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 26 Nov 2008 23:44:30 +0000 |
parent | 431:3c89a073db53 |
child | 451:e9f269e5204e |
comparison
equal
deleted
inserted
replaced
433:afbf29498123 | 434:0d7ba3742f7a |
---|---|
5 local sm_new_session = require "core.sessionmanager".new_session; | 5 local sm_new_session = require "core.sessionmanager".new_session; |
6 local s2s_new_incoming = require "core.s2smanager".new_incoming; | 6 local s2s_new_incoming = require "core.s2smanager".new_incoming; |
7 local s2s_streamopened = require "core.s2smanager".streamopened; | 7 local s2s_streamopened = require "core.s2smanager".streamopened; |
8 local s2s_streamclosed = require "core.s2smanager".streamclosed; | 8 local s2s_streamclosed = require "core.s2smanager".streamclosed; |
9 local s2s_destroy_session = require "core.s2smanager".destroy_session; | 9 local s2s_destroy_session = require "core.s2smanager".destroy_session; |
10 | 10 local s2s_attempt_connect = require "core.s2smanager".attempt_connection; |
11 local stream_callbacks = { streamopened = s2s_streamopened, streamclosed = s2s_streamclosed }; | 11 local stream_callbacks = { streamopened = s2s_streamopened, streamclosed = s2s_streamclosed }; |
12 | 12 |
13 local connlisteners_register = require "net.connlisteners".register; | 13 local connlisteners_register = require "net.connlisteners".register; |
14 | 14 |
15 local t_insert = table.insert; | 15 local t_insert = table.insert; |
107 if data then | 107 if data then |
108 session.data(conn, data); | 108 session.data(conn, data); |
109 end | 109 end |
110 end | 110 end |
111 | 111 |
112 function xmppserver.disconnect(conn) | 112 function xmppserver.disconnect(conn, err) |
113 local session = sessions[conn]; | 113 local session = sessions[conn]; |
114 if session then | 114 if session then |
115 (session.log or log)("info", "s2s disconnected: %s->%s", tostring(session.from_host), tostring(session.to_host)); | 115 if err and err ~= "closed" and session.srv_hosts then |
116 if s2s_attempt_connect(session, err) then | |
117 return; -- Session lives for now | |
118 end | |
119 end | |
120 (session.log or log)("info", "s2s disconnected: %s->%s (%s)", tostring(session.from_host), tostring(session.to_host), tostring(err)); | |
116 s2s_destroy_session(session); | 121 s2s_destroy_session(session); |
117 sessions[conn] = nil; | 122 sessions[conn] = nil; |
118 session = nil; | 123 session = nil; |
119 collectgarbage("collect"); | 124 collectgarbage("collect"); |
120 end | 125 end |