Software /
code /
prosody
Diff
plugins/mod_c2s.lua @ 11517:f7275c2c58fa
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`
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 14 Apr 2021 16:02:47 +0200 |
parent | 11514:11186af62c87 |
child | 11524:6de302b53a3e |
line wrap: on
line diff
--- a/plugins/mod_c2s.lua Wed Apr 14 15:21:13 2021 +0200 +++ b/plugins/mod_c2s.lua Wed Apr 14 16:02:47 2021 +0200 @@ -92,6 +92,9 @@ 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;