From a38713466c8d9c6b9733517bbd7e20c826dbeb63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Haa=C3=9F?= Date: Thu, 19 Mar 2026 20:35:46 +0100 Subject: [PATCH 1/2] proxy forgets packages if debuggee connects this might fix #344 when lua-debug wait for a conencting debuggee, after the connection is accepted nothing happens. lua-debug should send queued packages in that case, as it does in the other case where lua-debug connects to the debuggee --- extension/script/common/socket.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extension/script/common/socket.lua b/extension/script/common/socket.lua index 36deeaaf..76b66e5f 100644 --- a/extension/script/common/socket.lua +++ b/extension/script/common/socket.lua @@ -85,7 +85,13 @@ return function (param) elseif t.mode == "listen" then server = assert(net.listen(t.protocol, t.address, t.port)) function server:on_accepted(new_s) - return init_session(new_s) + local ok = init_session(new_s) + assert(ok) + if writebuf ~= '' then + new_s:write(writebuf) + writebuf = '' + end + return ok end else return From 80a66adb2e7ba3b3f84adf106da708dfa2043225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Haa=C3=9F?= Date: Sun, 3 May 2026 22:06:07 +0200 Subject: [PATCH 2/2] fix for review --- extension/script/common/socket.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extension/script/common/socket.lua b/extension/script/common/socket.lua index 76b66e5f..0272a8c6 100644 --- a/extension/script/common/socket.lua +++ b/extension/script/common/socket.lua @@ -86,7 +86,11 @@ return function (param) server = assert(net.listen(t.protocol, t.address, t.port)) function server:on_accepted(new_s) local ok = init_session(new_s) - assert(ok) + if not ok then + new_s:close() + error "Failed to initialize session." + return + end if writebuf ~= '' then new_s:write(writebuf) writebuf = ''