Software /
code /
prosody
Comparison
plugins/mod_s2s/mod_s2s.lua @ 10425:42cf93ff4618
s2s: Allow passing a custom error for bouncing queued stanzas (#770)
Since stream errors and stanza errors are different
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 23 Nov 2019 01:29:03 +0100 |
parent | 10421:09b54ad0fdc4 |
child | 10426:dd4eb84d92a8 |
comparison
equal
deleted
inserted
replaced
10424:e7d3fa49495f | 10425:42cf93ff4618 |
---|---|
485 end | 485 end |
486 end | 486 end |
487 | 487 |
488 --- Session methods | 488 --- Session methods |
489 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; | 489 local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'}; |
490 local function session_close(session, reason, remote_reason) | 490 local function session_close(session, reason, remote_reason, bounce_reason) |
491 local log = session.log or log; | 491 local log = session.log or log; |
492 if session.conn then | 492 if session.conn then |
493 if session.notopen then | 493 if session.notopen then |
494 if session.direction == "incoming" then | 494 if session.direction == "incoming" then |
495 session:open_stream(session.to_host, session.from_host); | 495 session:open_stream(session.to_host, session.from_host); |
535 local conn = session.conn; | 535 local conn = session.conn; |
536 if reason == nil and not session.notopen and session.incoming 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, bounce_reason); |
541 conn:close(); | 541 conn:close(); |
542 end | 542 end |
543 end); | 543 end); |
544 else | 544 else |
545 s2s_destroy_session(session, reason); | 545 s2s_destroy_session(session, reason, bounce_reason); |
546 conn:close(); -- Close immediately, as this is an outgoing connection or is not authed | 546 conn:close(); -- Close immediately, as this is an outgoing connection or is not authed |
547 end | 547 end |
548 end | 548 end |
549 end | 549 end |
550 | 550 |