Software /
code /
prosody
Comparison
core/s2smanager.lua @ 4107:c9363102afd2
Merge 0.8->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 10 Jan 2011 16:55:14 +0000 |
parent | 4078:05a58497a903 |
parent | 4106:e19fc274e182 |
child | 4131:81636fa77cab |
comparison
equal
deleted
inserted
replaced
4104:582ba9c459ad | 4107:c9363102afd2 |
---|---|
69 end; | 69 end; |
70 dummy = true; | 70 dummy = true; |
71 }; | 71 }; |
72 for i, data in ipairs(sendq) do | 72 for i, data in ipairs(sendq) do |
73 local reply = data[2]; | 73 local reply = data[2]; |
74 local xmlns = reply.attr.xmlns; | 74 if reply and not(reply.attr.xmlns) and bouncy_stanzas[reply.name] then |
75 if not(xmlns) and bouncy_stanzas[reply.name] then | |
76 reply.attr.type = "error"; | 75 reply.attr.type = "error"; |
77 reply:tag("error", {type = "cancel"}) | 76 reply:tag("error", {type = "cancel"}) |
78 :tag("remote-server-not-found", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):up(); | 77 :tag("remote-server-not-found", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):up(); |
79 if reason then | 78 if reason then |
80 reply:tag("text", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):text("Connection failed: "..reason):up(); | 79 reply:tag("text", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}):text("Connection failed: "..reason):up(); |
97 -- We have a connection to this host already | 96 -- We have a connection to this host already |
98 if host.type == "s2sout_unauthed" and (data.name ~= "db:verify" or not host.dialback_key) then | 97 if host.type == "s2sout_unauthed" and (data.name ~= "db:verify" or not host.dialback_key) then |
99 (host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host); | 98 (host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host); |
100 | 99 |
101 -- Queue stanza until we are able to send it | 100 -- Queue stanza until we are able to send it |
102 if host.sendq then t_insert(host.sendq, {tostring(data), st.reply(data)}); | 101 if host.sendq then t_insert(host.sendq, {tostring(data), data.attr.type ~= "error" and data.attr.type ~= "result" and st.reply(data)}); |
103 else host.sendq = { {tostring(data), st.reply(data)} }; end | 102 else host.sendq = { {tostring(data), data.attr.type ~= "error" and data.attr.type ~= "result" and st.reply(data)} }; end |
104 host.log("debug", "stanza [%s] queued ", data.name); | 103 host.log("debug", "stanza [%s] queued ", data.name); |
105 elseif host.type == "local" or host.type == "component" then | 104 elseif host.type == "local" or host.type == "component" then |
106 log("error", "Trying to send a stanza to ourselves??") | 105 log("error", "Trying to send a stanza to ourselves??") |
107 log("error", "Traceback: %s", get_traceback()); | 106 log("error", "Traceback: %s", get_traceback()); |
108 log("error", "Stanza: %s", tostring(data)); | 107 log("error", "Stanza: %s", tostring(data)); |
120 else | 119 else |
121 log("debug", "opening a new outgoing connection for this stanza"); | 120 log("debug", "opening a new outgoing connection for this stanza"); |
122 local host_session = new_outgoing(from_host, to_host); | 121 local host_session = new_outgoing(from_host, to_host); |
123 | 122 |
124 -- Store in buffer | 123 -- Store in buffer |
125 host_session.sendq = { {tostring(data), st.reply(data)} }; | 124 host_session.sendq = { {tostring(data), data.attr.type ~= "error" and data.attr.type ~= "result" and st.reply(data)} }; |
126 log("debug", "stanza [%s] queued until connection complete", tostring(data.name)); | 125 log("debug", "stanza [%s] queued until connection complete", tostring(data.name)); |
127 if (not host_session.connecting) and (not host_session.conn) then | 126 if (not host_session.connecting) and (not host_session.conn) then |
128 log("warn", "Connection to %s failed already, destroying session...", to_host); | 127 log("warn", "Connection to %s failed already, destroying session...", to_host); |
129 if not destroy_session(host_session, "Connection failed") then | 128 if not destroy_session(host_session, "Connection failed") then |
130 -- Already destroyed, we need to bounce our stanza | 129 -- Already destroyed, we need to bounce our stanza |