From 9db2bc5202ff412a0011e242af6753efe4c8217c Mon Sep 17 00:00:00 2001 From: Roman Shtylman Date: Mon, 18 Nov 2013 13:40:38 -0500 Subject: [PATCH] don't wait for server close to clear timeout --- proxy.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/proxy.js b/proxy.js index d332b44..79f7baa 100644 --- a/proxy.js +++ b/proxy.js @@ -39,7 +39,10 @@ var Proxy = function(opt, cb) { // user has 5 seconds to connect before their slot is given up function maybe_tcp_close() { clearTimeout(conn_timeout); - conn_timeout = setTimeout(client_server.close.bind(client_server), 5000); + conn_timeout = setTimeout(function() { + client_server.close(); + clearTimeout(conn_timeout); + }, 5000); } maybe_tcp_close();