Software /
code /
prosody
Comparison
net/xmppserver_listener.lua @ 1880:d5dc9e06d917
xmppserver_listener: Add status() function to signal when a connection completes its SSL handshake
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 04 Oct 2009 14:35:39 +0100 |
parent | 1879:42157c066813 |
child | 1902:a7b06e2539c8 |
comparison
equal
deleted
inserted
replaced
1879:42157c066813 | 1880:d5dc9e06d917 |
---|---|
132 if data then | 132 if data then |
133 session.data(conn, data); | 133 session.data(conn, data); |
134 end | 134 end |
135 end | 135 end |
136 | 136 |
137 function xmppserver.status(conn, status) | |
138 if status == "ssl-handshake-complete" then | |
139 local session = sessions[conn]; | |
140 if session and session.direction == "outgoing" then | |
141 local format, to_host, from_host = string.format, session.to_host, session.from_host; | |
142 session.log("warn", "Sending stream header..."); | |
143 session.sends2s(format([[<stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback' xmlns:stream='http://etherx.jabber.org/streams' from='%s' to='%s' version='1.0'>]], from_host, to_host)); | |
144 end | |
145 end | |
146 end | |
147 | |
137 function xmppserver.disconnect(conn, err) | 148 function xmppserver.disconnect(conn, err) |
138 local session = sessions[conn]; | 149 local session = sessions[conn]; |
139 if session then | 150 if session then |
140 if err and err ~= "closed" and session.srv_hosts then | 151 if err and err ~= "closed" and session.srv_hosts then |
141 (session.log or log)("debug", "s2s connection closed unexpectedly"); | 152 (session.log or log)("debug", "s2s connection closed unexpectedly"); |