Skip to content

Commit

Permalink
doc: clarify http2 server.close() behavior
Browse files Browse the repository at this point in the history
This commit is an attempt to clarify the behavior of HTTP2's
server.close() method. Specifically, this makes it more clear
that the server stops allowing new sessions although the
callback may not be invoked for some time due to previously
existing sessions.

PR-URL: nodejs#28581
Fixes: nodejs#28214
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
cjihrig committed Jul 8, 2019
1 parent e04ee9b commit 3091115
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -1749,11 +1749,14 @@ added: v8.4.0
-->
* `callback` {Function}

Stops the server from accepting new connections. See [`net.Server.close()`][].
Stops the server from establishing new sessions. This does not prevent new
request streams from being created due to the persistent nature of HTTP/2
sessions. To gracefully shut down the server, call [`http2session.close()`] on
all active sessions.

This is not analogous to restricting new requests since HTTP/2
connections are persistent. To achieve a similar graceful shutdown behavior,
consider also using [`http2session.close()`] on active sessions.
If `callback` is provided, it is not invoked until all active sessions have been
closed, although the server has already stopped allowing new sessions. See
[`net.Server.close()`][] for more details.

#### server.setTimeout([msecs][, callback])
<!-- YAML
Expand Down Expand Up @@ -1895,11 +1898,14 @@ added: v8.4.0
-->
* `callback` {Function}

Stops the server from accepting new connections. See [`tls.Server.close()`][].
Stops the server from establishing new sessions. This does not prevent new
request streams from being created due to the persistent nature of HTTP/2
sessions. To gracefully shut down the server, call [`http2session.close()`] on
all active sessions.

This is not analogous to restricting new requests since HTTP/2
connections are persistent. To achieve a similar graceful shutdown behavior,
consider also using [`http2session.close()`] on active sessions.
If `callback` is provided, it is not invoked until all active sessions have been
closed, although the server has already stopped allowing new sessions. See
[`tls.Server.close()`][] for more details.

#### server.setTimeout([msecs][, callback])
<!-- YAML
Expand Down

0 comments on commit 3091115

Please sign in to comment.