mirror of https://github.com/nodejs/node.git
Add 'opening' readyState
parent
33d5c46e8c
commit
916e057fea
12
lib/net.js
12
lib/net.js
|
@ -4,10 +4,8 @@ var events = require("events");
|
|||
|
||||
var debugLevel = 0;
|
||||
if ('NODE_DEBUG' in process.ENV) debugLevel = 1;
|
||||
function debug (x) {
|
||||
if (debugLevel > 0) {
|
||||
process.stdio.writeError(x + '\n');
|
||||
}
|
||||
function debug () {
|
||||
if (debugLevel > 0) sys.error.apply(this, arguments);
|
||||
}
|
||||
|
||||
var binding = process.binding('net');
|
||||
|
@ -400,7 +398,9 @@ Object.defineProperty(Stream.prototype, 'readyState', {
|
|||
readyStateMessage = 'readyState is depricated. Use stream.readable or stream.writable';
|
||||
sys.error(readyStateMessage);
|
||||
}
|
||||
if (this.readable && this.writable) {
|
||||
if (this._resolving) {
|
||||
return 'opening';
|
||||
} else if (this.readable && this.writable) {
|
||||
return 'open';
|
||||
} else if (this.readable && !this.writable){
|
||||
return 'readOnly';
|
||||
|
@ -658,7 +658,9 @@ Stream.prototype.connect = function () {
|
|||
self.type = 'tcp';
|
||||
// TODO dns resolution on arguments[1]
|
||||
var port = arguments[0];
|
||||
self._resolving = true;
|
||||
lookupDomainName(arguments[1], function (ip) {
|
||||
self._resolving = false;
|
||||
doConnect(self, port, ip);
|
||||
});
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue