Merge pull request #388 from bantu/inject-socket-object

Allow existing Socket object to be injected.
fork
Brian White 10 years ago
commit e542ce8727

@ -47,6 +47,7 @@ function Connection(config) {
config || (config = {});
this._config = {
socket: config.socket,
host: config.host || 'localhost',
port: config.port || 143,
tls: config.tls,
@ -63,7 +64,7 @@ function Connection(config) {
: true)
};
this._sock = undefined;
this._sock = config.socket || undefined;
this._tagcount = 0;
this._tmrConn = undefined;
this._tmrKeepalive = undefined;
@ -83,7 +84,7 @@ inherits(Connection, EventEmitter);
Connection.prototype.connect = function() {
var config = this._config, self = this, socket, parser, tlsOptions;
socket = new Socket();
socket = config.socket || new Socket();
socket.setKeepAlive(true);
socket.setTimeout(0);
this._sock = undefined;

Loading…
Cancel
Save