aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-06-27 01:22:36 +0200
committerKim Alvefur <zash@zash.se>2022-06-27 01:22:36 +0200
commit814817ebf21306625268dbacba88eb4f539b1626 (patch)
treea11e3c596999bccf595ab4eaecc5f632d596f84f
parent1261dfba9f026ea1854ee16c078d81c0797f1e4a (diff)
downloadprosody-814817ebf21306625268dbacba88eb4f539b1626.tar.gz
prosody-814817ebf21306625268dbacba88eb4f539b1626.zip
core.s2smanager: Don't remove unrelated session on close of bidi session
Normally with bidi, any outgoing connection should be the same as the incoming, hence when closing a bidi connection it should be removed as a route to the remote server. However it is not guaranteed, a remote bidi-capable server might have decided to open a new connection for some reason. This can lead to a situation where there are two bidi connections, and the s2sout route is a locally initiated s2sout connection. In this case, such a s2sout connection should be kept. Noticed in a rare case where bidi has just been enabled on a running server, and something establishes new connections immediately when a connection is closed.
-rw-r--r--core/s2smanager.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/s2smanager.lua b/core/s2smanager.lua
index b683e9ca..b9190993 100644
--- a/core/s2smanager.lua
+++ b/core/s2smanager.lua
@@ -94,7 +94,7 @@ local function destroy_session(session, reason, bounce_reason)
hosts[session.from_host].s2sout[session.to_host] = nil;
session:bounce_sendq(bounce_reason or reason);
elseif session.direction == "incoming" then
- if session.outgoing then
+ if session.outgoing and hosts[session.to_host].s2sout[session.from_host] == session then
hosts[session.to_host].s2sout[session.from_host] = nil;
end
incoming_s2s[session] = nil;