mod_proxy65: Don't read data from the connection untill the proxying is activated

Thu, 03 Dec 2009 17:07:37 +0100

author
Sjoerd Simons <sjoerd.simons@collabora.co.uk>
date
Thu, 03 Dec 2009 17:07:37 +0100
changeset 2311
5fe837ebe542
parent 2310
e74c6740a42b
child 2312
5ddbb9c89ffe

mod_proxy65: Don't read data from the connection untill the proxying is activated

plugins/mod_proxy65.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_proxy65.lua	Thu Dec 03 17:05:35 2009 +0100
+++ b/plugins/mod_proxy65.lua	Thu Dec 03 17:07:37 2009 +0100
@@ -88,6 +88,7 @@
 				throttle_sending(transfers[sha].target, conn);          
 			end
 			conn:write(string.char(5, 0, 0, 3, sha:len()) .. sha .. string.char(0, 0)); -- VER, REP, RSV, ATYP, BND.ADDR (sha), BND.PORT (2 Byte)
+			conn:lock_read(true)
 		else
 			module:log("warn", "Neither data transfer nor initial connect of a participator of a transfer.")
 			conn.close();
@@ -243,6 +244,8 @@
 				elseif(transfers[sha] ~= nil and transfers[sha].initiator ~= nil and transfers[sha].target ~= nil) then
 					origin.send(reply);
 					transfers[sha].activated = true;
+					transfers[sha].target:lock_read(false);
+					transfers[sha].initiator:lock_read(false);
 				end
 			else
 				module:log("error", "activation failed: sid: %s, initiator: %s, target: %s", tostring(sid), tostring(from), tostring(to));

mercurial