diff options
author | Kim Alvefur <zash@zash.se> | 2021-04-14 16:02:47 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-04-14 16:02:47 +0200 |
commit | 21fa25b27b77a10ec6547adc2c16f66c48f1eb7f (patch) | |
tree | d45d5b4f50a0045a1d67d3b7613f3eca5fac94e0 /plugins | |
parent | a4a008e046e060eb3d0d697b2a1445a62120d91d (diff) | |
download | prosody-21fa25b27b77a10ec6547adc2c16f66c48f1eb7f.tar.gz prosody-21fa25b27b77a10ec6547adc2c16f66c48f1eb7f.zip |
mod_c2s: Fix traceback if session was destroyed while opening stream (thanks Ge0rG)
Could happen with the 'opportunistic_writes' setting, since then the
stream opening is written directly to the socket, which can in turn
trigger session destruction if the socket somehow got closed just after
the other sent their stream header.
Error happens later when it tries to `hosts[session.host == nil].events`
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_c2s.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index fc838c0d..a222f939 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -92,6 +92,9 @@ function stream_callbacks._streamopened(session, attr) session:open_stream(host, attr.from); + -- Opening the stream can cause the stream to be closed + if session.destroyed then return end + (session.log or log)("debug", "Sent reply <stream:stream> to client"); session.notopen = nil; |