|
|
@ -91,7 +91,7 @@ var timeout = new (function () { |
|
|
|
remove(socket); |
|
|
|
socket._idleNext = list._idleNext; |
|
|
|
socket._idleNext._idlePrev = socket; |
|
|
|
socket._idlePrev = list |
|
|
|
socket._idlePrev = list; |
|
|
|
list._idleNext = socket; |
|
|
|
} |
|
|
|
|
|
|
@ -200,7 +200,7 @@ var timeout = new (function () { |
|
|
|
socket._idlePrev._idleNext = socket._idleNext; |
|
|
|
socket._idleNext = list._idleNext; |
|
|
|
socket._idleNext._idlePrev = socket; |
|
|
|
socket._idlePrev = list |
|
|
|
socket._idlePrev = list; |
|
|
|
list._idleNext = socket; |
|
|
|
} |
|
|
|
} |
|
|
@ -313,7 +313,7 @@ function setImplmentationMethods (self) { |
|
|
|
} |
|
|
|
|
|
|
|
self._shutdownImpl = function () { |
|
|
|
shutdown(self.fd, 'write') |
|
|
|
shutdown(self.fd, 'write'); |
|
|
|
}; |
|
|
|
|
|
|
|
if (self.secure) { |
|
|
@ -525,7 +525,7 @@ function Stream (fd, type) { |
|
|
|
this.type = null; |
|
|
|
this.secure = false; |
|
|
|
|
|
|
|
if (parseInt(fd) >= 0) { |
|
|
|
if (parseInt(fd, 10) >= 0) { |
|
|
|
this.open(fd, type); |
|
|
|
} else { |
|
|
|
setImplmentationMethods(this); |
|
|
@ -567,7 +567,7 @@ Stream.prototype.setSecure = function (credentials) { |
|
|
|
// If client, trigger handshake
|
|
|
|
this._checkForSecureHandshake(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Stream.prototype.verifyPeer = function () { |
|
|
@ -575,7 +575,7 @@ Stream.prototype.verifyPeer = function () { |
|
|
|
throw new Error('Stream is not a secure stream.'); |
|
|
|
} |
|
|
|
return this.secureStream.verifyPeer(this.credentials.context); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Stream.prototype._checkForSecureHandshake = function () { |
|
|
@ -586,7 +586,7 @@ Stream.prototype._checkForSecureHandshake = function () { |
|
|
|
// Do an empty write to see if we need to write out as part of handshake
|
|
|
|
if (!emptyBuffer) allocEmptyBuffer(); |
|
|
|
this.write(emptyBuffer); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Stream.prototype.getPeerCertificate = function (credentials) { |
|
|
@ -594,7 +594,7 @@ Stream.prototype.getPeerCertificate = function (credentials) { |
|
|
|
throw new Error('Stream is not a secure stream.'); |
|
|
|
} |
|
|
|
return this.secureStream.getPeerCertificate(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Stream.prototype.getCipher = function () { |
|
|
@ -602,7 +602,7 @@ Stream.prototype.getCipher = function () { |
|
|
|
throw new Error('Stream is not a secure stream.'); |
|
|
|
} |
|
|
|
return this.secureStream.getCurrentCipher(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
Stream.prototype.open = function (fd, type) { |
|
|
@ -616,7 +616,7 @@ Stream.prototype.open = function (fd, type) { |
|
|
|
|
|
|
|
this._writeWatcher.set(this.fd, false, true); |
|
|
|
this.writable = true; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
exports.createConnection = function (port, host) { |
|
|
@ -703,7 +703,7 @@ Stream.prototype._writeOut = function (data, encoding, fd) { |
|
|
|
len = data.length; |
|
|
|
|
|
|
|
} else { |
|
|
|
assert(typeof data == 'string') |
|
|
|
assert(typeof data == 'string'); |
|
|
|
|
|
|
|
if (!pool || pool.length - pool.used < kMinPoolSpace) { |
|
|
|
pool = null; |
|
|
@ -788,7 +788,7 @@ Stream.prototype._writeOut = function (data, encoding, fd) { |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Flushes the write buffer out.
|
|
|
@ -869,7 +869,7 @@ function doConnect (socket, port, host) { |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
function toPort (x) { return (x = Number(x)) >= 0 ? x : false } |
|
|
|
function toPort (x) { return (x = Number(x)) >= 0 ? x : false; } |
|
|
|
|
|
|
|
|
|
|
|
// var stream = new Stream();
|
|
|
@ -886,7 +886,7 @@ Stream.prototype.connect = function () { |
|
|
|
|
|
|
|
self._connecting = true; // set false in doConnect
|
|
|
|
|
|
|
|
var port = toPort(arguments[0]) |
|
|
|
var port = toPort(arguments[0]); |
|
|
|
if (port === false) { |
|
|
|
// UNIX
|
|
|
|
self.fd = socket('unix'); |
|
|
@ -1102,7 +1102,7 @@ Server.prototype.listen = function () { |
|
|
|
self.addListener('listening', lastArg); |
|
|
|
} |
|
|
|
|
|
|
|
var port = toPort(arguments[0]) |
|
|
|
var port = toPort(arguments[0]); |
|
|
|
if (port === false) { |
|
|
|
// the first argument specifies a path
|
|
|
|
self.fd = socket('unix'); |
|
|
@ -1176,7 +1176,7 @@ Server.prototype._startWatcher = function () { |
|
|
|
Server.prototype._doListen = function () { |
|
|
|
listen(this.fd, 128); |
|
|
|
this._startWatcher(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|