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: #28581
Fixes: #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 authored and targos committed Jul 20, 2019
1 parent 2205818 commit 6f3ebb8
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 @@ -1748,11 +1748,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 @@ -1893,11 +1896,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 6f3ebb8

Please sign in to comment.