Changeset

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
parents 11516:83822be7704d
children 11518:3f1a865e9419
files plugins/mod_c2s.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
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;