From b98b9e39975ab2bd5f11b119aefb7f55d595a8a2 Mon Sep 17 00:00:00 2001 From: Tony Mobily Date: Fri, 3 Oct 2014 21:26:54 +0800 Subject: [PATCH] Applied a default to config.socketTimeout, renamed error name to something more specific, added space for style --- lib/Connection.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Connection.js b/lib/Connection.js index d51b74d..eee5cbb 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -56,7 +56,7 @@ function Connection(config) { this._config = { socket: config.socket, - socketTimeout: config.socketTimeout, + socketTimeout: config.socketTimeout || 0, host: config.host || 'localhost', port: config.port || 143, tls: config.tls, @@ -150,7 +150,7 @@ Connection.prototype.connect = function() { }; this._sock.on('error', this._onError); - this._onSocketTimeout = function(){ + this._onSocketTimeout = function() { clearTimeout(self._tmrConn); clearTimeout(self._tmrAuth); clearTimeout(self._tmrKeepalive); @@ -158,7 +158,7 @@ Connection.prototype.connect = function() { self.debug && self.debug('[connection] Socket timeout'); var err = new Error('Socket timed out while talking to server'); - err.source = 'timeout'; + err.source = 'socket-timeout'; self.emit('error', err); socket.destroy(); };