Mercurial > prosody-hg
comparison plugins/mod_s2s.lua @ 11417:f84005d06663
mod_s2s: Check direction in bidi-aware style
Both session.incoming and session.outgoing are truthy here, but
session.direction indicates the "real" direction in the way that matters
for the order of events when opening or closing streams.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 03 Mar 2021 13:26:38 +0100 |
| parents | a38f9e09ca31 |
| children | 2c26dfc1977f |
comparison
equal
deleted
inserted
replaced
| 11416:0a9d6eec6a8f | 11417:f84005d06663 |
|---|---|
| 540 session.log("info", "%s s2s stream %s->%s closed: %s", session.direction:gsub("^.", string.upper), | 540 session.log("info", "%s s2s stream %s->%s closed: %s", session.direction:gsub("^.", string.upper), |
| 541 session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason or "stream closed"); | 541 session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason or "stream closed"); |
| 542 | 542 |
| 543 -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote | 543 -- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote |
| 544 local conn = session.conn; | 544 local conn = session.conn; |
| 545 if reason == nil and not session.notopen and session.incoming then | 545 if reason == nil and not session.notopen and session.direction == "incoming" then |
| 546 add_task(stream_close_timeout, function () | 546 add_task(stream_close_timeout, function () |
| 547 if not session.destroyed then | 547 if not session.destroyed then |
| 548 session.log("warn", "Failed to receive a stream close response, closing connection anyway..."); | 548 session.log("warn", "Failed to receive a stream close response, closing connection anyway..."); |
| 549 s2s_destroy_session(session, reason, bounce_reason); | 549 s2s_destroy_session(session, reason, bounce_reason); |
| 550 conn:close(); | 550 conn:close(); |
