diff plugins/mod_proxy65.lua @ 14158:f34ad235cf3b 0.12

mod_proxy65: Don't link connections until after activation Although the module pauses the connections, in some cases server.link() (at least with the epoll backend) will have the effect of unpausing the connection (because it sets new read handlers). Many thanks to Max Hearnden for discovering and reporting this issue.
author Matthew Wild <mwild1@gmail.com>
date Wed, 29 Apr 2026 11:37:21 +0100
parents 3bbb1af92514
children 4bbb17445ed9
line wrap: on
line diff
--- a/plugins/mod_proxy65.lua	Fri Apr 17 17:39:06 2026 +0100
+++ b/plugins/mod_proxy65.lua	Wed Apr 29 11:37:21 2026 +0100
@@ -60,8 +60,6 @@
 				transfers[sha].initiator = conn;
 				session.sha = sha;
 				module:log("debug", "SOCKS5 initiator connected for session %s", sha);
-				server.link(conn, transfers[sha].target, max_buffer_size);
-				server.link(transfers[sha].target, conn, max_buffer_size);
 			end
 		else -- error, unexpected input
 			conn:write("\5\1\0\3\0\0\0"); -- VER, REP, RSV, ATYP, BND.ADDR (sha), BND.PORT (2 Byte)
@@ -166,6 +164,8 @@
 			else -- if transfers[sha].initiator ~= nil and transfers[sha].target ~= nil then
 				module:log("debug", "Transfer activated (%s)", info);
 				transfers[sha].activated = true;
+				server.link(transfers[sha].initiator, transfers[sha].target, max_buffer_size);
+				server.link(transfers[sha].target, transfers[sha].initiator, max_buffer_size);
 				transfers[sha].target:resume();
 				transfers[sha].initiator:resume();
 				origin.send(st.reply(stanza));