Node.js: changed the unit-http socket constructor.

Third-party file descriptors are not supported.
Socket "readable" and "writable" options are set true by default.
This commit is contained in:
Alexander Borisov
2018-12-19 15:56:06 +03:00
parent f47a5db506
commit dc16885b60

View File

@@ -18,10 +18,16 @@ function Socket(options) {
throw new TypeError('Options must be object'); throw new TypeError('Options must be object');
} }
this.readable = (typeof options.readable === 'boolean' ? options.readable if ("fd" in options) {
: false); throw new TypeError('Working with file descriptors not supported');
this.writable = (typeof options.writable === 'boolean' ? options.writable }
: false);
/*
* For HTTP TCP socket 'readable' and 'writable' are always true.
* These options are required by Express and Koa frameworks.
*/
this.readable = true;
this.writable = true;
} }
util.inherits(Socket, EventEmitter); util.inherits(Socket, EventEmitter);
@@ -43,7 +49,6 @@ Socket.prototype.connect = function connect(options, connectListener) {
this.once('connect', connectListener); this.once('connect', connectListener);
this.connecting = true; this.connecting = true;
this.writable = true;
return this; return this;
}; };