mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
parent
2de0611b43
commit
9c7f89bf56
20
lib/tls.js
20
lib/tls.js
@ -216,9 +216,23 @@ CryptoStream.prototype._done = function() {
|
||||
};
|
||||
|
||||
|
||||
CryptoStream.prototype.fd = -1;
|
||||
CryptoStream.prototype.__defineGetter__('readyState',
|
||||
net.Socket.prototype.__lookupGetter__('readyState'));
|
||||
// readyState is deprecated. Don't use it.
|
||||
Object.defineProperty(CryptoStream.prototype, 'readyState', {
|
||||
get: function() {
|
||||
if (this._connecting) {
|
||||
return 'opening';
|
||||
} else if (this.readable && this.writable) {
|
||||
return 'open';
|
||||
} else if (this.readable && !this.writable) {
|
||||
return 'readOnly';
|
||||
} else if (!this.readable && this.writable) {
|
||||
return 'writeOnly';
|
||||
} else {
|
||||
return 'closed';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Move decrypted, clear data out into the application.
|
||||
// From the user's perspective this occurs as a 'data' event
|
||||
|
@ -54,6 +54,11 @@ server.listen(common.PORT, function() {
|
||||
|
||||
|
||||
client.on('close', function() {
|
||||
// readyState is deprecated but we want to make
|
||||
// sure this isn't triggering an assert in lib/net.js
|
||||
// See issue #1069.
|
||||
assert.equal('closed', client.readyState);
|
||||
|
||||
assert.equal(buffer, message);
|
||||
console.log(message);
|
||||
server.close();
|
||||
|
Loading…
Reference in New Issue
Block a user