Mercurial > prosody-hg
comparison core/s2smanager.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 |
| parents | 56522bb3bca5 |
| children | f4b76e500768 |
comparison
equal
deleted
inserted
replaced
| 10424:e7d3fa49495f | 10425:42cf93ff4618 |
|---|---|
| 82 session.thread = { run = function (_, data) return session.data(data) end }; | 82 session.thread = { run = function (_, data) return session.data(data) end }; |
| 83 session.sends2s = session.send; | 83 session.sends2s = session.send; |
| 84 return setmetatable(session, resting_session); | 84 return setmetatable(session, resting_session); |
| 85 end | 85 end |
| 86 | 86 |
| 87 local function destroy_session(session, reason) | 87 local function destroy_session(session, reason, bounce_reason) |
| 88 if session.destroyed then return; end | 88 if session.destroyed then return; end |
| 89 local log = session.log or log; | 89 local log = session.log or log; |
| 90 log("debug", "Destroying %s session %s->%s%s%s", session.direction, session.from_host, session.to_host, reason and ": " or "", reason or ""); | 90 log("debug", "Destroying %s session %s->%s%s%s", session.direction, session.from_host, session.to_host, reason and ": " or "", reason or ""); |
| 91 | 91 |
| 92 if session.direction == "outgoing" then | 92 if session.direction == "outgoing" then |
| 93 hosts[session.from_host].s2sout[session.to_host] = nil; | 93 hosts[session.from_host].s2sout[session.to_host] = nil; |
| 94 session:bounce_sendq(reason); | 94 session:bounce_sendq(bounce_reason or reason); |
| 95 elseif session.direction == "incoming" then | 95 elseif session.direction == "incoming" then |
| 96 if session.outgoing then | 96 if session.outgoing then |
| 97 hosts[session.to_host].s2sout[session.from_host] = nil; | 97 hosts[session.to_host].s2sout[session.from_host] = nil; |
| 98 end | 98 end |
| 99 incoming_s2s[session] = nil; | 99 incoming_s2s[session] = nil; |
