|
@ -78,21 +78,24 @@ function Socket(options) { |
|
|
stream.Stream.call(this); |
|
|
stream.Stream.call(this); |
|
|
|
|
|
|
|
|
if (typeof options == 'number') { |
|
|
if (typeof options == 'number') { |
|
|
// Legacy interface. Uncomment the following lines after
|
|
|
// Legacy interface.
|
|
|
// libuv backend is stable and API compatibile with legaacy.
|
|
|
|
|
|
// console.error('Deprecated interface net.Socket(fd).');
|
|
|
|
|
|
// console.trace();
|
|
|
|
|
|
// Must support legacy interface. NPM depends on it.
|
|
|
// Must support legacy interface. NPM depends on it.
|
|
|
// https://github.com/isaacs/npm/blob/c7824f412f0cb59d6f55cf0bc220253c39e6029f/lib/utils/output.js#L110
|
|
|
// https://github.com/isaacs/npm/blob/c7824f412f0cb59d6f55cf0bc220253c39e6029f/lib/utils/output.js#L110
|
|
|
// TODO Before we can do this we need a way to open a uv_stream_t by fd.
|
|
|
var fd = options; |
|
|
throw new Error("Not yet implemented") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// private
|
|
|
// Uncomment the following lines after libuv backend is stable and API
|
|
|
this._handle = options && options.handle; |
|
|
// compatibile with legaacy.
|
|
|
initSocketHandle(this); |
|
|
// console.error('Deprecated interface net.Socket(fd).');
|
|
|
|
|
|
// console.trace();
|
|
|
this.allowHalfOpen = options && options.allowHalfOpen; |
|
|
this._handle = createPipe(); |
|
|
|
|
|
this._handle.open(fd); |
|
|
|
|
|
initSocketHandle(this); |
|
|
|
|
|
} else { |
|
|
|
|
|
// private
|
|
|
|
|
|
this._handle = options && options.handle; |
|
|
|
|
|
initSocketHandle(this); |
|
|
|
|
|
this.allowHalfOpen = options && options.allowHalfOpen; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
util.inherits(Socket, stream.Stream); |
|
|
util.inherits(Socket, stream.Stream); |
|
|
|
|
|
|
|
|