summaryrefslogtreecommitdiff
path: root/lib/net.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2013-01-17 09:52:48 -0800
committerisaacs <i@izs.me>2013-01-17 10:42:44 -0800
commit1528de23735d752f397371db9cc668aec0e67d36 (patch)
tree8d6a47b26517659d1ef0fac14875366c6803fc74 /lib/net.js
parentb48e303af023dc60b6f6590694ba94d9b8108702 (diff)
downloadandroid-node-v8-1528de23735d752f397371db9cc668aec0e67d36.tar.gz
android-node-v8-1528de23735d752f397371db9cc668aec0e67d36.tar.bz2
android-node-v8-1528de23735d752f397371db9cc668aec0e67d36.zip
stdio: Set readable/writable flags properly
Set the readable/writable flags properly in net streams that have a handle passed in (such as TTY streams). Fix #4606
Diffstat (limited to 'lib/net.js')
-rw-r--r--lib/net.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/net.js b/lib/net.js
index 89cb0d7275..41e28195ae 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -137,17 +137,17 @@ function Socket(options) {
}
stream.Duplex.call(this, options);
- this.readable = this.writable = false;
if (options.handle) {
this._handle = options.handle; // private
- } else if (typeof options.fd === 'undefined') {
- this._handle = options && options.handle; // private
- } else {
+ } else if (typeof options.fd !== 'undefined') {
this._handle = createPipe();
this._handle.open(options.fd);
this.readable = options.readable !== false;
this.writable = options.writable !== false;
+ } else {
+ // these will be set once there is a connection
+ this.readable = this.writable = false;
}
this.onend = null;