Software /
code /
prosody
Comparison
core/s2smanager.lua @ 559:fa4a51fe6442
Remove an incorrect line which I didn't add, and fix the proper way. Corrects the sending of stanzas over unauthed s2sout's. Also fixes mod_dialback to send stanzas and not strings.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 05 Dec 2008 05:23:42 +0000 |
parent | 558:ab3960421356 |
child | 583:5821eaa80baa |
comparison
equal
deleted
inserted
replaced
558:ab3960421356 | 559:fa4a51fe6442 |
---|---|
50 module "s2smanager" | 50 module "s2smanager" |
51 | 51 |
52 local function compare_srv_priorities(a,b) return a.priority < b.priority or a.weight < b.weight; end | 52 local function compare_srv_priorities(a,b) return a.priority < b.priority or a.weight < b.weight; end |
53 | 53 |
54 function send_to_host(from_host, to_host, data) | 54 function send_to_host(from_host, to_host, data) |
55 if data.name then data = tostring(data); end | |
56 local host = hosts[from_host].s2sout[to_host]; | 55 local host = hosts[from_host].s2sout[to_host]; |
57 if host then | 56 if host then |
58 -- We have a connection to this host already | 57 -- We have a connection to this host already |
59 if host.type == "s2sout_unauthed" and (data.xmlns == "jabber:client" or data.xmlns == "jabber:server") then | 58 if host.type == "s2sout_unauthed" and data.name ~= "db:verify" and ((not data.xmlns) or data.xmlns == "jabber:client" or data.xmlns == "jabber:server") then |
60 (host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host); | 59 (host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host); |
61 if not host.notopen and not host.dialback_key then | 60 if not host.notopen and not host.dialback_key then |
62 host.log("debug", "dialback had not been initiated"); | 61 host.log("debug", "dialback had not been initiated"); |
63 initiate_dialback(host); | 62 initiate_dialback(host); |
64 end | 63 end |
65 | 64 |
66 -- Queue stanza until we are able to send it | 65 -- Queue stanza until we are able to send it |
67 if host.sendq then t_insert(host.sendq, data); | 66 if host.sendq then t_insert(host.sendq, tostring(data)); |
68 else host.sendq = { data }; end | 67 else host.sendq = { tostring(data) }; end |
69 host.log("debug", "stanza queued"); | 68 host.log("debug", "stanza [%s] queued ", data.name); |
70 elseif host.type == "local" or host.type == "component" then | 69 elseif host.type == "local" or host.type == "component" then |
71 log("error", "Trying to send a stanza to ourselves??") | 70 log("error", "Trying to send a stanza to ourselves??") |
72 log("error", "Traceback: %s", get_traceback()); | 71 log("error", "Traceback: %s", get_traceback()); |
73 log("error", "Stanza: %s", tostring(data)); | 72 log("error", "Stanza: %s", tostring(data)); |
74 else | 73 else |
83 end | 82 end |
84 else | 83 else |
85 log("debug", "opening a new outgoing connection for this stanza"); | 84 log("debug", "opening a new outgoing connection for this stanza"); |
86 local host_session = new_outgoing(from_host, to_host); | 85 local host_session = new_outgoing(from_host, to_host); |
87 -- Store in buffer | 86 -- Store in buffer |
88 host_session.sendq = { data }; | 87 host_session.sendq = { tostring(data) }; |
89 end | 88 end |
90 end | 89 end |
91 | 90 |
92 local open_sessions = 0; | 91 local open_sessions = 0; |
93 | 92 |