aboutsummaryrefslogtreecommitdiffstats
path: root/core/s2smanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-11-14 02:54:56 +0000
committerMatthew Wild <mwild1@gmail.com>2008-11-14 02:54:56 +0000
commit22df06d27db30cae5c7d3361a4fe51ab9a89dcbc (patch)
tree3d632e375aca4712448301b7a3a968b855db54bd /core/s2smanager.lua
parent428fc65bbc595d80cb678dadcc9ea7cae055d5b9 (diff)
downloadprosody-22df06d27db30cae5c7d3361a4fe51ab9a89dcbc.tar.gz
prosody-22df06d27db30cae5c7d3361a4fe51ab9a89dcbc.zip
Now outgoing s2s sessions are associated with their from_host, fixes #15
Diffstat (limited to 'core/s2smanager.lua')
-rw-r--r--core/s2smanager.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index 6d00ff6e..3f286d0e 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -32,7 +32,7 @@ function connect_host(from_host, to_host)
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 @@ function send_to_host(from_host, to_host, data)
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 @@ end
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 @@ end
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;