From 9bdb40e97ce92797088d2dfa5eb82c00d8ea641e Mon Sep 17 00:00:00 2001 From: Roman Shtylman Date: Sat, 25 Oct 2014 17:05:19 -0700 Subject: [PATCH] when remote endpoint has an error, just close it --- client.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/client.js b/client.js index beef84c..8a81502 100644 --- a/client.js +++ b/client.js @@ -77,19 +77,14 @@ TunnelCluster.prototype.open = function() { port: remote_port }); - remote.once('error', function(err) { + remote.on('error', function(err) { // emit connection refused errors immediately, because they // indicate that the tunnel can't be established. if (err.code === 'ECONNREFUSED') { self.emit('error', new Error('connection refused: ' + remote_host + ':' + remote_port + ' (check your firewall settings)')); } - else if (err.code !== 'ETIMEDOUT') { - self.emit('error', err); - } - setTimeout(function() { - self.emit('dead'); - }, 1000); + remote.end(); }); function conn_local() {