Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: do not mention TCP in the allowHalfOpen option description #38360

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 18 additions & 16 deletions doc/api/net.md
Expand Up @@ -551,9 +551,9 @@ changes:
* `options` {Object} Available options are:
* `fd` {number} If specified, wrap around an existing socket with
the given file descriptor, otherwise a new socket will be created.
* `allowHalfOpen` {boolean} Indicates whether half-opened TCP connections
are allowed. See [`net.createServer()`][] and the [`'end'`][] event
for details. **Default:** `false`.
* `allowHalfOpen` {boolean} Indicates whether to automatically end the
writable side when the readable side ends. See [`net.createServer()`][] and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make it sound like you should set it to true to automatically end the writable side when in fact the opposite is true?

Copy link
Member Author

@lpinca lpinca Apr 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Indicates whether to not automatically end the writable side when the readable side ends.
  2. Indicates whether to keep the writable side open when the readable side ends.
  3. Other suggestions?

Copy link
Member Author

@lpinca lpinca Apr 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL, I've used the same wording used here https://nodejs.org/api/stream.html#stream_new_stream_duplex_options.

the [`'end'`][] event for details. **Default:** `false`.
* `readable` {boolean} Allow reads on the socket when an `fd` is passed,
otherwise ignored. **Default:** `false`.
* `writable` {boolean} Allow writes on the socket when an `fd` is passed,
Expand Down Expand Up @@ -612,14 +612,14 @@ See also: the return values of `socket.write()`.
added: v0.1.90
-->

Emitted when the other end of the socket sends a FIN packet, thus ending the
readable side of the socket.
Emitted when the other end of the socket signals the end of transmission, thus
ending the readable side of the socket.

By default (`allowHalfOpen` is `false`) the socket will send a FIN packet
back and destroy its file descriptor once it has written out its pending
write queue. However, if `allowHalfOpen` is set to `true`, the socket will
not automatically [`end()`][`socket.end()`] its writable side, allowing the
user to write arbitrary amounts of data. The user must call
By default (`allowHalfOpen` is `false`) the socket will send an end of
transmission packet back and destroy its file descriptor once it has written out
its pending write queue. However, if `allowHalfOpen` is set to `true`, the
socket will not automatically [`end()`][`socket.end()`] its writable side,
allowing the user to write arbitrary amounts of data. The user must call
[`end()`][`socket.end()`] explicitly to close the connection (i.e. sending a
FIN packet back).

Expand Down Expand Up @@ -1295,8 +1295,8 @@ added: v0.5.0
-->

* `options` {Object}
* `allowHalfOpen` {boolean} Indicates whether half-opened TCP
connections are allowed. **Default:** `false`.
* `allowHalfOpen` {boolean} Indicates whether to automatically end the
writable side when the readable side ends. **Default:** `false`.
* `pauseOnConnect` {boolean} Indicates whether the socket should be
paused on incoming connections. **Default:** `false`.
* `connectionListener` {Function} Automatically set as a listener for the
Expand All @@ -1306,10 +1306,12 @@ added: v0.5.0
Creates a new TCP or [IPC][] 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
[`socket.end()`][] is explicitly called, until then the connection is
half-closed (non-readable but still writable). See [`'end'`][] event
and [RFC 1122][half-closed] (section 4.2.2.13) for more information.
signals the end of transmission, the server will only send back the end of
transmission when [`socket.end()`][] is explicitly called. For example, in the
context of TCP, when a FIN packed is received, a FIN packed is sent
back only when [`socket.end()`][] is explicitly called. Until then the
connection is half-closed (non-readable but still writable). See [`'end'`][]
event and [RFC 1122][half-closed] (section 4.2.2.13) for more information.

If `pauseOnConnect` is set to `true`, then the socket associated with each
incoming connection will be paused, and no data will be read from its handle.
Expand Down
2 changes: 1 addition & 1 deletion doc/api/tls.md
Expand Up @@ -1473,7 +1473,7 @@ changes:
responsibility; calling `tls.connect()` will not cause `net.connect()` to be
called.
* `allowHalfOpen` {boolean} If the `socket` option is missing, indicates
whether or not to allow the internally created socket to be half-open,
whether to automatically end the writable side when the readable side ends,
otherwise the option is ignored. See the `allowHalfOpen` option of
[`net.Socket`][] for details. **Default:** `false`.
* `rejectUnauthorized` {boolean} If not `false`, the server certificate is
Expand Down