Comparison

plugins/mod_s2s/mod_s2s.lua @ 10421:09b54ad0fdc4

mod_s2s: Wait for remote to close any connection allowing incoming stanzas Ie both s2sin and bidi-enabled s2sout.
author Kim Alvefur <zash@zash.se>
date Mon, 18 Nov 2019 20:37:40 +0100
parent 10403:3b82e9df5a7a
child 10425:42cf93ff4618
comparison
equal deleted inserted replaced
10420:49a828819696 10421:09b54ad0fdc4
531 session.log("info", "%s s2s stream %s->%s closed: %s", session.direction:gsub("^.", string.upper), 531 session.log("info", "%s s2s stream %s->%s closed: %s", session.direction:gsub("^.", string.upper),
532 session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason or "stream closed"); 532 session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason or "stream closed");
533 533
534 -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote 534 -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote
535 local conn = session.conn; 535 local conn = session.conn;
536 if reason == nil and not session.notopen and session.type == "s2sin" then 536 if reason == nil and not session.notopen and session.incoming then
537 add_task(stream_close_timeout, function () 537 add_task(stream_close_timeout, function ()
538 if not session.destroyed then 538 if not session.destroyed then
539 session.log("warn", "Failed to receive a stream close response, closing connection anyway..."); 539 session.log("warn", "Failed to receive a stream close response, closing connection anyway...");
540 s2s_destroy_session(session, reason); 540 s2s_destroy_session(session, reason);
541 conn:close(); 541 conn:close();