aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-05-13 21:55:08 +0200
committerKim Alvefur <zash@zash.se>2015-05-13 21:55:08 +0200
commit54e6e73b9c65d2e6a649e33d815959a9ceac8ddd (patch)
treebbe7caf3fa040045c7590273b9fcc55e2b7c567e /plugins
parent7227eb122a6ac2c2647314c390c961cabecf63b9 (diff)
downloadprosody-54e6e73b9c65d2e6a649e33d815959a9ceac8ddd.tar.gz
prosody-54e6e73b9c65d2e6a649e33d815959a9ceac8ddd.zip
mod_s2s: Don't cache session.sends2s (or do it later), prevents sending data after session was closed
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_s2s/mod_s2s.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index f5297efe..1408fd5e 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -147,7 +147,7 @@ end
-- Stream is authorised, and ready for normal stanzas
function mark_connected(session)
- local sendq, send = session.sendq, session.sends2s;
+ local sendq = session.sendq;
local from, to = session.from_host, session.to_host;
@@ -170,6 +170,7 @@ function mark_connected(session)
if session.direction == "outgoing" then
if sendq then
session.log("debug", "sending %d queued stanzas across new outgoing connection to %s", #sendq, session.to_host);
+ local send = session.sends2s;
for i, data in ipairs(sendq) do
send(data[1]);
sendq[i] = nil;
@@ -269,8 +270,6 @@ local stream_callbacks = { default_ns = "jabber:server", handlestanza = core_pr
local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams";
function stream_callbacks.streamopened(session, attr)
- local send = session.sends2s;
-
session.version = tonumber(attr.version) or 0;
-- TODO: Rename session.secure to session.encrypted
@@ -360,7 +359,7 @@ function stream_callbacks.streamopened(session, attr)
end
log("debug", "Sending stream features: %s", tostring(features));
- send(features);
+ session.sends2s(features);
end
session.notopen = nil;
elseif session.direction == "outgoing" then