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(); };