Skip to content

Commit ed5ef21

Browse files
lpincatargos
authored andcommitted
doc: do not mention TCP in the allowHalfOpen option description
The `allowHalfOpen` option works in the same way for both TCP and IPC connections. PR-URL: #38360 Fixes: #38307 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 042985c commit ed5ef21

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

doc/api/net.md

+20-16
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,10 @@ changes:
551551
* `options` {Object} Available options are:
552552
* `fd` {number} If specified, wrap around an existing socket with
553553
the given file descriptor, otherwise a new socket will be created.
554-
* `allowHalfOpen` {boolean} Indicates whether half-opened TCP connections
555-
are allowed. See [`net.createServer()`][] and the [`'end'`][] event
556-
for details. **Default:** `false`.
554+
* `allowHalfOpen` {boolean} If set to `false`, then the socket will
555+
automatically end the writable side when the readable side ends. See
556+
[`net.createServer()`][] and the [`'end'`][] event for details. **Default:**
557+
`false`.
557558
* `readable` {boolean} Allow reads on the socket when an `fd` is passed,
558559
otherwise ignored. **Default:** `false`.
559560
* `writable` {boolean} Allow writes on the socket when an `fd` is passed,
@@ -612,14 +613,14 @@ See also: the return values of `socket.write()`.
612613
added: v0.1.90
613614
-->
614615

615-
Emitted when the other end of the socket sends a FIN packet, thus ending the
616-
readable side of the socket.
616+
Emitted when the other end of the socket signals the end of transmission, thus
617+
ending the readable side of the socket.
617618

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

@@ -1295,8 +1296,9 @@ added: v0.5.0
12951296
-->
12961297

12971298
* `options` {Object}
1298-
* `allowHalfOpen` {boolean} Indicates whether half-opened TCP
1299-
connections are allowed. **Default:** `false`.
1299+
* `allowHalfOpen` {boolean} If set to `false`, then the socket will
1300+
automatically end the writable side when the readable side ends.
1301+
**Default:** `false`.
13001302
* `pauseOnConnect` {boolean} Indicates whether the socket should be
13011303
paused on incoming connections. **Default:** `false`.
13021304
* `connectionListener` {Function} Automatically set as a listener for the
@@ -1306,10 +1308,12 @@ added: v0.5.0
13061308
Creates a new TCP or [IPC][] server.
13071309

13081310
If `allowHalfOpen` is set to `true`, when the other end of the socket
1309-
sends a FIN packet, the server will only send a FIN packet back when
1310-
[`socket.end()`][] is explicitly called, until then the connection is
1311-
half-closed (non-readable but still writable). See [`'end'`][] event
1312-
and [RFC 1122][half-closed] (section 4.2.2.13) for more information.
1311+
signals the end of transmission, the server will only send back the end of
1312+
transmission when [`socket.end()`][] is explicitly called. For example, in the
1313+
context of TCP, when a FIN packed is received, a FIN packed is sent
1314+
back only when [`socket.end()`][] is explicitly called. Until then the
1315+
connection is half-closed (non-readable but still writable). See [`'end'`][]
1316+
event and [RFC 1122][half-closed] (section 4.2.2.13) for more information.
13131317

13141318
If `pauseOnConnect` is set to `true`, then the socket associated with each
13151319
incoming connection will be paused, and no data will be read from its handle.

doc/api/tls.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1473,10 +1473,10 @@ changes:
14731473
Connection/disconnection/destruction of `socket` is the user's
14741474
responsibility; calling `tls.connect()` will not cause `net.connect()` to be
14751475
called.
1476-
* `allowHalfOpen` {boolean} If the `socket` option is missing, indicates
1477-
whether or not to allow the internally created socket to be half-open,
1478-
otherwise the option is ignored. See the `allowHalfOpen` option of
1479-
[`net.Socket`][] for details. **Default:** `false`.
1476+
* `allowHalfOpen` {boolean} If set to `false`, then the socket will
1477+
automatically end the writable side when the readable side ends. If the
1478+
`socket` option is set, this option has no effect. See the `allowHalfOpen`
1479+
option of [`net.Socket`][] for details. **Default:** `false`.
14801480
* `rejectUnauthorized` {boolean} If not `false`, the server certificate is
14811481
verified against the list of supplied CAs. An `'error'` event is emitted if
14821482
verification fails; `err.code` contains the OpenSSL error code. **Default:**

0 commit comments

Comments
 (0)