Software /
code /
prosody
Changeset
260:182f0c895676
Now outgoing s2s sessions are associated with their from_host, fixes #15
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 14 Nov 2008 02:54:56 +0000 |
parents | 259:1485d272400d |
children | 261:790cf21e2af7 267:6303b7454ad0 |
files | core/s2smanager.lua main.lua plugins/mod_dialback.lua |
diffstat | 3 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/core/s2smanager.lua Fri Nov 14 02:41:37 2008 +0000 +++ b/core/s2smanager.lua Fri Nov 14 02:54:56 2008 +0000 @@ -32,7 +32,7 @@ end function send_to_host(from_host, to_host, data) - local host = hosts[to_host]; + local host = hosts[from_host].s2sout[to_host]; if host then -- We have a connection to this host already if host.type == "s2sout_unauthed" then @@ -52,12 +52,12 @@ else (host.log or log)("debug", "going to send stanza to "..to_host.." from "..from_host); -- FIXME - if hosts[to_host].from_host ~= from_host then + if host.from_host ~= from_host then log("error", "WARNING! This might, possibly, be a bug, but it might not..."); - log("error", "We are going to send from %s instead of %s", hosts[to_host].from_host, from_host); + log("error", "We are going to send from %s instead of %s", host.from_host, from_host); end - hosts[to_host].sends2s(data); - host.log("debug", "stanza sent over "..hosts[to_host].type); + host.sends2s(data); + host.log("debug", "stanza sent over "..host.type); end else log("debug", "opening a new outgoing connection for this stanza"); @@ -87,7 +87,7 @@ function new_outgoing(from_host, to_host) local host_session = { to_host = to_host, from_host = from_host, notopen = true, type = "s2sout_unauthed", direction = "outgoing" }; - hosts[to_host] = host_session; + hosts[from_host].s2sout[to_host] = host_session; local cl = connlisteners_get("xmppserver"); local conn, handler = socket.tcp() @@ -225,7 +225,7 @@ function destroy_session(session) (session.log or log)("info", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host)); if session.direction == "outgoing" then - hosts[session.to_host] = nil; + hosts[session.from_host].s2sout[session.to_host] = nil; end session.conn = nil; session.disconnect = nil;
--- a/main.lua Fri Nov 14 02:41:37 2008 +0000 +++ b/main.lua Fri Nov 14 02:54:56 2008 +0000 @@ -17,7 +17,7 @@ if config.hosts and #config.hosts > 0 then for _, host in pairs(config.hosts) do - hosts[host] = {type = "local", connected = true, sessions = {}, host = host}; + hosts[host] = {type = "local", connected = true, sessions = {}, host = host, s2sout = {} }; end else error("No hosts defined in the configuration file"); end
--- a/plugins/mod_dialback.lua Fri Nov 14 02:41:37 2008 +0000 +++ b/plugins/mod_dialback.lua Fri Nov 14 02:54:56 2008 +0000 @@ -39,7 +39,7 @@ send_s2s(origin.to_host, origin.from_host, format("<db:verify from='%s' to='%s' id='%s'>%s</db:verify>", origin.to_host, origin.from_host, origin.streamid, origin.dialback_key)); - hosts[origin.from_host].dialback_verifying = origin; + hosts[origin.to_host].s2sout[origin.from_host].dialback_verifying = origin; end); add_handler({ "s2sout_unauthed", "s2sout" }, "verify", xmlns_dialback,