Don't send GOAWAY with last stream ID larger than the value previously sent
This commit is contained in:
parent
817e1ce2a7
commit
975524a125
|
@ -322,6 +322,7 @@ static int session_new(nghttp2_session **session_ptr,
|
||||||
(*session_ptr)->local_window_size = NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE;
|
(*session_ptr)->local_window_size = NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE;
|
||||||
|
|
||||||
(*session_ptr)->goaway_flags = NGHTTP2_GOAWAY_NONE;
|
(*session_ptr)->goaway_flags = NGHTTP2_GOAWAY_NONE;
|
||||||
|
(*session_ptr)->local_last_stream_id = (1u << 31) - 1;
|
||||||
(*session_ptr)->remote_last_stream_id = 0;
|
(*session_ptr)->remote_last_stream_id = 0;
|
||||||
|
|
||||||
(*session_ptr)->inflight_niv = -1;
|
(*session_ptr)->inflight_niv = -1;
|
||||||
|
@ -1727,11 +1728,17 @@ static int session_prep_frame(nghttp2_session *session,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NGHTTP2_GOAWAY:
|
case NGHTTP2_GOAWAY:
|
||||||
|
if(session->local_last_stream_id < frame->goaway.last_stream_id) {
|
||||||
|
return NGHTTP2_ERR_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
|
||||||
framerv = nghttp2_frame_pack_goaway(&session->aob.framebufs,
|
framerv = nghttp2_frame_pack_goaway(&session->aob.framebufs,
|
||||||
&frame->goaway);
|
&frame->goaway);
|
||||||
if(framerv < 0) {
|
if(framerv < 0) {
|
||||||
return framerv;
|
return framerv;
|
||||||
}
|
}
|
||||||
|
session->local_last_stream_id = frame->goaway.last_stream_id;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case NGHTTP2_EXT_ALTSVC:
|
case NGHTTP2_EXT_ALTSVC:
|
||||||
rv = session_predicate_altsvc_send(session, frame->hd.stream_id);
|
rv = session_predicate_altsvc_send(session, frame->hd.stream_id);
|
||||||
|
|
|
@ -189,6 +189,8 @@ struct nghttp2_session {
|
||||||
/* Counter of unique ID of PING. Wraps when it exceeds
|
/* Counter of unique ID of PING. Wraps when it exceeds
|
||||||
NGHTTP2_MAX_UNIQUE_ID */
|
NGHTTP2_MAX_UNIQUE_ID */
|
||||||
uint32_t next_unique_id;
|
uint32_t next_unique_id;
|
||||||
|
/* This is the last-stream-ID we have sent in GOAWAY */
|
||||||
|
int32_t local_last_stream_id;
|
||||||
/* This is the value in GOAWAY frame received from remote endpoint. */
|
/* This is the value in GOAWAY frame received from remote endpoint. */
|
||||||
int32_t remote_last_stream_id;
|
int32_t remote_last_stream_id;
|
||||||
/* Current sender window size. This value is computed against the
|
/* Current sender window size. This value is computed against the
|
||||||
|
|
Loading…
Reference in New Issue