Created
February 10, 2012 20:01
-
-
Save mdz/1792301 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/slya-proxy.js b/slya-proxy.js | |
index 57d5c39..0df2ca0 100644 | |
--- a/slya-proxy.js | |
+++ b/slya-proxy.js | |
@@ -109,6 +109,9 @@ function setupIptables(portMap) { | |
function TCPProxy(port, destPort, destHost) { | |
return net.createServer(function (inbound) { | |
+ // suppress data events until we're ready | |
+ inbound.pause(); | |
+ | |
var outbound = net.createConnection(destPort, destHost); | |
outbound.on('connect', function() { | |
// Pass all data back and forth | |
@@ -127,6 +130,9 @@ function TCPProxy(port, destPort, destHost) { | |
inbound.end(); | |
cleanup(); | |
}); | |
+ | |
+ // ok, all ready to pass data | |
+ inbound.resume(); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment