Comparison

core/s2smanager.lua @ 12586:4c8941b5b05e 0.12

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.
author Kim Alvefur <zash@zash.se>
date Mon, 27 Jun 2022 01:22:36 +0200 (2022-06-26)
parent 11900:60676b607b6d
child 12972:ead41e25ebc0
comparison
equal deleted inserted replaced
12584:fb0bf0a0864f 12586:4c8941b5b05e
92 92
93 if session.direction == "outgoing" then 93 if session.direction == "outgoing" then
94 hosts[session.from_host].s2sout[session.to_host] = nil; 94 hosts[session.from_host].s2sout[session.to_host] = nil;
95 session:bounce_sendq(bounce_reason or reason); 95 session:bounce_sendq(bounce_reason or reason);
96 elseif session.direction == "incoming" then 96 elseif session.direction == "incoming" then
97 if session.outgoing then 97 if session.outgoing and hosts[session.to_host].s2sout[session.from_host] == session then
98 hosts[session.to_host].s2sout[session.from_host] = nil; 98 hosts[session.to_host].s2sout[session.from_host] = nil;
99 end 99 end
100 incoming_s2s[session] = nil; 100 incoming_s2s[session] = nil;
101 end 101 end
102 102