From 21fa25b27b77a10ec6547adc2c16f66c48f1eb7f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 14 Apr 2021 16:02:47 +0200 Subject: 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` --- plugins/mod_c2s.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins/mod_c2s.lua') 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 to client"); session.notopen = nil; -- cgit v1.2.3