Skip to content

Commit dcdbaff

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 fe8003e commit dcdbaff

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

doc/api/net.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,10 @@ added: v0.3.4
419419
* `options` {Object} Available options are:
420420
* `fd` {number} If specified, wrap around an existing socket with
421421
the given file descriptor, otherwise a new socket will be created.
422-
* `allowHalfOpen` {boolean} Indicates whether half-opened TCP connections
423-
are allowed. See [`net.createServer()`][] and the [`'end'`][] event
424-
for details. **Default:** `false`.
422+
* `allowHalfOpen` {boolean} If set to `false`, then the socket will
423+
automatically end the writable side when the readable side ends. See
424+
[`net.createServer()`][] and the [`'end'`][] event for details. **Default:**
425+
`false`.
425426
* `readable` {boolean} Allow reads on the socket when an `fd` is passed,
426427
otherwise ignored. **Default:** `false`.
427428
* `writable` {boolean} Allow writes on the socket when an `fd` is passed,
@@ -478,14 +479,14 @@ See also: the return values of `socket.write()`.
478479
added: v0.1.90
479480
-->
480481

481-
Emitted when the other end of the socket sends a FIN packet, thus ending the
482-
readable side of the socket.
482+
Emitted when the other end of the socket signals the end of transmission, thus
483+
ending the readable side of the socket.
483484

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

@@ -1161,8 +1162,9 @@ added: v0.5.0
11611162
-->
11621163

11631164
* `options` {Object}
1164-
* `allowHalfOpen` {boolean} Indicates whether half-opened TCP
1165-
connections are allowed. **Default:** `false`.
1165+
* `allowHalfOpen` {boolean} If set to `false`, then the socket will
1166+
automatically end the writable side when the readable side ends.
1167+
**Default:** `false`.
11661168
* `pauseOnConnect` {boolean} Indicates whether the socket should be
11671169
paused on incoming connections. **Default:** `false`.
11681170
* `connectionListener` {Function} Automatically set as a listener for the
@@ -1172,10 +1174,12 @@ added: v0.5.0
11721174
Creates a new TCP or [IPC][] server.
11731175

11741176
If `allowHalfOpen` is set to `true`, when the other end of the socket
1175-
sends a FIN packet, the server will only send a FIN packet back when
1176-
[`socket.end()`][] is explicitly called, until then the connection is
1177-
half-closed (non-readable but still writable). See [`'end'`][] event
1178-
and [RFC 1122][half-closed] (section 4.2.2.13) for more information.
1177+
signals the end of transmission, the server will only send back the end of
1178+
transmission when [`socket.end()`][] is explicitly called. For example, in the
1179+
context of TCP, when a FIN packed is received, a FIN packed is sent
1180+
back only when [`socket.end()`][] is explicitly called. Until then the
1181+
connection is half-closed (non-readable but still writable). See [`'end'`][]
1182+
event and [RFC 1122][half-closed] (section 4.2.2.13) for more information.
11791183

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

doc/api/tls.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,10 +1409,10 @@ changes:
14091409
Connection/disconnection/destruction of `socket` is the user's
14101410
responsibility; calling `tls.connect()` will not cause `net.connect()` to be
14111411
called.
1412-
* `allowHalfOpen` {boolean} If the `socket` option is missing, indicates
1413-
whether or not to allow the internally created socket to be half-open,
1414-
otherwise the option is ignored. See the `allowHalfOpen` option of
1415-
[`net.Socket`][] for details. **Default:** `false`.
1412+
* `allowHalfOpen` {boolean} If set to `false`, then the socket will
1413+
automatically end the writable side when the readable side ends. If the
1414+
`socket` option is set, this option has no effect. See the `allowHalfOpen`
1415+
option of [`net.Socket`][] for details. **Default:** `false`.
14161416
* `rejectUnauthorized` {boolean} If not `false`, the server certificate is
14171417
verified against the list of supplied CAs. An `'error'` event is emitted if
14181418
verification fails; `err.code` contains the OpenSSL error code. **Default:**

0 commit comments

Comments
 (0)