Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
Merge nodejs/master
Browse files Browse the repository at this point in the history
Merge de4a749 as of 2017-06-15.
This is an automatically created merge. For any problems please
contact @kunalspathak.
  • Loading branch information
chakrabot committed Jun 20, 2017
2 parents 6d7f46e + de4a749 commit 123ce1a
Show file tree
Hide file tree
Showing 28 changed files with 333 additions and 105 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V8.md#8.1.1">8.1.1</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V8.md#8.1.2">8.1.2</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V8.md#8.1.1">8.1.1</a>><br/>
<a href="doc/changelogs/CHANGELOG_V8.md#8.1.0">8.1.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V8.md#8.0.0">8.0.0</a><br/>
</td>
Expand Down
12 changes: 12 additions & 0 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,12 @@ communication channel to a child process. See [`child.send()`] and
Used generically to identify when an invalid or unexpected value has been
passed in an options object.

<a id="ERR_INVALID_REPL_EVAL_CONFIG"></a>
### ERR_INVALID_REPL_EVAL_CONFIG

Used when both `breakEvalOnSigint` and `eval` options are set
in the REPL config, which is not supported.

<a id="ERR_INVALID_SYNC_FORK_INPUT"></a>
### ERR_INVALID_SYNC_FORK_INPUT

Expand Down Expand Up @@ -742,6 +748,12 @@ Used when data cannot be sent on a socket.

Used when a call is made and the UDP subsystem is not running.

<a id="ERR_NO_CRYPTO"></a>
### ERR_NO_CRYPTO

Used when an attempt is made to use crypto features while Node.js is not
compiled with OpenSSL crypto support.

<a id="ERR_STDERR_CLOSE"></a>
### ERR_STDERR_CLOSE

Expand Down
2 changes: 1 addition & 1 deletion doc/api/https.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ added: v8.0.0

See [`http.Server#keepAliveTimeout`][].

## https.createServer(options[, requestListener])
## https.createServer([options][, requestListener])
<!-- YAML
added: v0.3.4
-->
Expand Down
60 changes: 44 additions & 16 deletions doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ This class is used to create a TCP or [IPC][] server.

## new net.Server([options][, connectionListener])

* Returns: {net.Server}

See [`net.createServer([options][, connectionListener])`][`net.createServer()`].

`net.Server` is an [`EventEmitter`][] with the following events:
Expand Down Expand Up @@ -130,13 +132,17 @@ Don't call `server.address()` until the `'listening'` event has been emitted.
added: v0.1.90
-->

* Returns: {net.Server}

Stops the server from accepting new connections and keeps existing
connections. This function is asynchronous, the server is finally
closed when all connections are ended and the server emits a [`'close'`][] event.
The optional `callback` will be called once the `'close'` event occurs. Unlike
that event, it will be called with an Error as its only argument if the server
was not open when it was closed.

Returns `server`.

### server.connections
<!-- YAML
added: v0.2.0
Expand All @@ -156,6 +162,8 @@ connections use asynchronous `server.getConnections` instead.
added: v0.9.7
-->

* Returns {net.Server}

Asynchronously get the number of concurrent connections on the server. Works
when sockets were sent to forks.

Expand Down Expand Up @@ -218,6 +226,7 @@ added: v0.5.10
* `handle` {Object}
* `backlog` {number} Common parameter of [`server.listen()`][] functions
* `callback` {Function} Common parameter of [`server.listen()`][] functions
* Returns: {net.Server}

Start a server listening for connections on a given `handle` that has
already been bound to a port, a UNIX domain socket, or a Windows named pipe.
Expand All @@ -243,6 +252,7 @@ added: v0.11.14
* `exclusive` {boolean} Default to `false`
* `callback` {Function} Common parameter of [`server.listen()`][]
functions
* Returns: {net.Server}

If `port` is specified, it behaves the same as
[`server.listen([port][, hostname][, backlog][, callback])`][`server.listen(port, host)`].
Expand Down Expand Up @@ -273,6 +283,7 @@ added: v0.1.90
[Identifying paths for IPC connections][].
* `backlog` {number} Common parameter of [`server.listen()`][] functions
* `callback` {Function} Common parameter of [`server.listen()`][] functions
* Returns: {net.Server}

Start a [IPC][] server listening for connections on the given `path`.

Expand All @@ -284,6 +295,7 @@ added: v0.1.90
* `host` {string}
* `backlog` {number} Common parameter of [`server.listen()`][] functions
* `callback` {Function} Common parameter of [`server.listen()`][] functions
* Returns: {net.Server}

Start a TCP server listening for connections on the given `port` and `host`.

Expand Down Expand Up @@ -323,23 +335,23 @@ with [`child_process.fork()`][].
added: v0.9.1
-->

* Returns: {net.Server}

Opposite of `unref`, calling `ref` on a previously `unref`d server will *not*
let the program exit if it's the only server left (the default behavior). If
the server is `ref`d calling `ref` again will have no effect.

Returns `server`.

### server.unref()
<!-- YAML
added: v0.9.1
-->

* Returns: {net.Server}

Calling `unref` on a server will allow the program to exit if this is the only
active server in the event system. If the server is already `unref`d calling
`unref` again will have no effect.

Returns `server`.

## Class: net.Socket
<!-- YAML
added: v0.3.4
Expand Down Expand Up @@ -532,6 +544,7 @@ Possible signatures:
for [IPC][] connections.
* [socket.connect(port[, host][, connectListener])][`socket.connect(port, host)`]
for TCP connections.
* Returns: {net.Socket} The socket itself.

This function is asynchronous. When the connection is established, the
[`'connect'`][] event will be emitted. If there is a problem connecting,
Expand Down Expand Up @@ -578,6 +591,8 @@ For [IPC][] connections, available `options` are:
* `path` {string} Required. Path the client should connect to.
See [Identifying paths for IPC connections][].

Returns `socket`.

#### socket.connect(path[, connectListener])

* `path` {string} Path the client should connect to. See
Expand All @@ -592,6 +607,8 @@ Alias to
[`socket.connect(options[, connectListener])`][`socket.connect(options)`]
called with `{ path: path }` as `options`.

Returns `socket`.

#### socket.connect(port[, host][, connectListener])
<!-- YAML
added: v0.1.90
Expand All @@ -609,6 +626,8 @@ Alias to
[`socket.connect(options[, connectListener])`][`socket.connect(options)`]
called with `{port: port, host: host}` as `options`.

Returns `socket`.

### socket.connecting
<!-- YAML
added: v6.1.0
Expand All @@ -626,6 +645,8 @@ callback.
added: v0.1.90
-->

* Returns: {net.Socket}

Ensures that no more I/O activity happens on this socket. Only necessary in
case of errors (parse error or so).

Expand All @@ -642,14 +663,14 @@ connection is destroyed no further data can be transferred using it.
added: v0.1.90
-->

* Returns: {net.Socket} The socket itself.

Half-closes the socket. i.e., it sends a FIN packet. It is possible the
server will still send some data.

If `data` is specified, it is equivalent to calling
`socket.write(data, encoding)` followed by [`socket.end()`][].

Returns `socket`.

### socket.localAddress
<!-- YAML
added: v0.9.6
Expand All @@ -670,6 +691,8 @@ The numeric representation of the local port. For example,

### socket.pause()

* Returns: {net.Socket} The socket itself.

Pauses the reading of data. That is, [`'data'`][] events will not be emitted.
Useful to throttle back an upload.

Expand All @@ -678,12 +701,12 @@ Useful to throttle back an upload.
added: v0.9.1
-->

* Returns: {net.Socket} The socket itself.

Opposite of `unref`, calling `ref` on a previously `unref`d socket will *not*
let the program exit if it's the only socket left (the default behavior). If
the socket is `ref`d calling `ref` again will have no effect.

Returns `socket`.

### socket.remoteAddress
<!-- YAML
added: v0.5.10
Expand All @@ -710,13 +733,17 @@ The numeric representation of the remote port. For example,

### socket.resume()

* Returns: {net.Socket} The socket itself.

Resumes reading after a call to [`socket.pause()`][].

### socket.setEncoding([encoding])
<!-- YAML
added: v0.1.90
-->

* Returns: {net.Socket} The socket itself.

Set the encoding for the socket as a [Readable Stream][]. See
[`stream.setEncoding()`][] for more information.

Expand All @@ -725,6 +752,8 @@ Set the encoding for the socket as a [Readable Stream][]. See
added: v0.1.92
-->

* Returns: {net.Socket} The socket itself.

Enable/disable keep-alive functionality, and optionally set the initial
delay before the first keepalive probe is sent on an idle socket.
`enable` defaults to `false`.
Expand All @@ -734,25 +763,25 @@ data packet received and the first keepalive probe. Setting 0 for
initialDelay will leave the value unchanged from the default
(or previous) setting. Defaults to `0`.

Returns `socket`.

### socket.setNoDelay([noDelay])
<!-- YAML
added: v0.1.90
-->

* Returns: {net.Socket} The socket itself.

Disables the Nagle algorithm. By default TCP connections use the Nagle
algorithm, they buffer data before sending it off. Setting `true` for
`noDelay` will immediately fire off data each time `socket.write()` is called.
`noDelay` defaults to `true`.

Returns `socket`.

### socket.setTimeout(timeout[, callback])
<!-- YAML
added: v0.1.90
-->

* Returns: {net.Socket} The socket itself.

Sets the socket to timeout after `timeout` milliseconds of inactivity on
the socket. By default `net.Socket` do not have a timeout.

Expand All @@ -773,19 +802,17 @@ If `timeout` is 0, then the existing idle timeout is disabled.
The optional `callback` parameter will be added as a one time listener for the
[`'timeout'`][] event.

Returns `socket`.

### socket.unref()
<!-- YAML
added: v0.9.1
-->

* Returns: {net.Socket} The socket itself.

Calling `unref` on a socket will allow the program to exit if this is the only
active socket in the event system. If the socket is already `unref`d calling
`unref` again will have no effect.

Returns `socket`.

### socket.write(data[, encoding][, callback])
<!-- YAML
added: v0.1.90
Expand Down Expand Up @@ -965,6 +992,7 @@ Creates a new TCP or [IPC][] server.
should be paused on incoming connections.
* `connectionListener` {Function} Automatically set as a listener for the
[`'connection'`][] event
* Returns: {net.Server}

If `allowHalfOpen` is set to `true`, when the other end of the socket
sends a FIN packet, the server will only send a FIN packet back when
Expand Down
4 changes: 3 additions & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,10 @@ A Writable stream in object mode will always ignore the `encoding` argument.
added: v8.0.0
-->

* Returns: `this`

Destroy the stream, and emit the passed error. After this call, the
writible stream has ended. Implementors should not override this method,
writable stream has ended. Implementors should not override this method,
but instead implement [`writable._destroy`][writable-_destroy].

### Readable Streams
Expand Down
9 changes: 9 additions & 0 deletions doc/changelogs/CHANGELOG_V8.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</tr>
<tr>
<td>
<a href="#8.1.2">8.1.2</a><br/>
<a href="#8.1.1">8.1.1</a><br/>
<a href="#8.1.0">8.1.0</a><br/>
<a href="#8.0.0">8.0.0</a><br/>
Expand All @@ -23,6 +24,14 @@
* [io.js](CHANGELOG_IOJS.md)
* [Archive](CHANGELOG_ARCHIVE.md)

<a id="8.1.2"></a>
## 2017-06-15, Version 8.1.2 (Current), @rvagg

### Notable changes

Release to fix broken `process.release` properties
Ref: https://github.com/nodejs/node/issues/13667

<a id="8.1.1"></a>
## 2017-06-13, Version 8.1.1 (Current), @addaleax

Expand Down
9 changes: 4 additions & 5 deletions lib/_stream_transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
'use strict';

module.exports = Transform;

const errors = require('internal/errors');
const Duplex = require('_stream_duplex');
const util = require('util');
util.inherits(Transform, Duplex);
Expand All @@ -78,7 +78,7 @@ function afterTransform(er, data) {

if (!cb) {
return this.emit('error',
new Error('write callback called multiple times'));
new errors.Error('ERR_TRANSFORM_MULTIPLE_CALLBACK'));
}

ts.writechunk = null;
Expand Down Expand Up @@ -210,10 +210,9 @@ function done(stream, er, data) {
// if there's nothing in the write buffer, then that means
// that nothing more will ever be provided
if (stream._writableState.length)
throw new Error('Calling transform done when ws.length != 0');
throw new errors.Error('ERR_TRANSFORM_WITH_LENGTH_0');

if (stream._transformState.transforming)
throw new Error('Calling transform done when still transforming');

throw new errors.Error('ERR_TRANSFORM_ALREADY_TRANSFORMING');
return stream.push(null);
}
4 changes: 4 additions & 0 deletions lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,10 @@ exports.connect = function(...args /* [port,] [host,] [options,] [cb] */) {
socket._hadError = true;
var error = new Error('socket hang up');
error.code = 'ECONNRESET';
error.path = options.path;
error.host = options.host;
error.port = options.port;
error.localAddress = options.localAddress;
socket.destroy(error);
}
}
Expand Down
Loading

0 comments on commit 123ce1a

Please sign in to comment.