Imported Upstream version 1.46.0
[platform/upstream/nghttp2.git] / doc / nghttp2_submit_shutdown_notice.rst
1
2 nghttp2_submit_shutdown_notice
3 ==============================
4
5 Synopsis
6 --------
7
8 *#include <nghttp2/nghttp2.h>*
9
10 .. function:: int nghttp2_submit_shutdown_notice(nghttp2_session *session)
11
12     
13     Signals to the client that the server started graceful shutdown
14     procedure.
15     
16     This function is only usable for server.  If this function is
17     called with client side session, this function returns
18     :macro:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE`.
19     
20     To gracefully shutdown HTTP/2 session, server should call this
21     function to send GOAWAY with last_stream_id (1u << 31) - 1.  And
22     after some delay (e.g., 1 RTT), send another GOAWAY with the stream
23     ID that the server has some processing using
24     `nghttp2_submit_goaway()`.  See also
25     `nghttp2_session_get_last_proc_stream_id()`.
26     
27     Unlike `nghttp2_submit_goaway()`, this function just sends GOAWAY
28     and does nothing more.  This is a mere indication to the client
29     that session shutdown is imminent.  The application should call
30     `nghttp2_submit_goaway()` with appropriate last_stream_id after
31     this call.
32     
33     If one or more GOAWAY frame have been already sent by either
34     `nghttp2_submit_goaway()` or `nghttp2_session_terminate_session()`,
35     this function has no effect.
36     
37     This function returns 0 if it succeeds, or one of the following
38     negative error codes:
39     
40     :macro:`nghttp2_error.NGHTTP2_ERR_NOMEM`
41         Out of memory.
42     :macro:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE`
43         The *session* is initialized as client.