Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
11516:83822be7704d | 11517:f7275c2c58fa |
---|---|
89 session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; | 89 session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; |
90 return; | 90 return; |
91 end | 91 end |
92 | 92 |
93 session:open_stream(host, attr.from); | 93 session:open_stream(host, attr.from); |
94 | |
95 -- Opening the stream can cause the stream to be closed | |
96 if session.destroyed then return end | |
94 | 97 |
95 (session.log or log)("debug", "Sent reply <stream:stream> to client"); | 98 (session.log or log)("debug", "Sent reply <stream:stream> to client"); |
96 session.notopen = nil; | 99 session.notopen = nil; |
97 | 100 |
98 -- If session.secure is *false* (not nil) then it means we /were/ encrypting | 101 -- If session.secure is *false* (not nil) then it means we /were/ encrypting |