Commit cbbecfeb authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Fix broken session_detect_idle_stream()

parent cdcea804
......@@ -1898,7 +1898,7 @@ static int session_detect_idle_stream(nghttp2_session *session,
{
/* Assume that stream object with stream_id does not exist */
if(nghttp2_session_is_my_stream_id(session, stream_id)) {
if(session->next_stream_id >= (uint32_t)stream_id) {
if(session->next_stream_id <= (uint32_t)stream_id) {
return 1;
}
return 0;
......@@ -2914,7 +2914,7 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session,
if(!stream || stream->state == NGHTTP2_STREAM_CLOSING) {
if(!stream) {
if(session_detect_idle_stream(session, frame->hd.stream_id)) {
return nghttp2_session_handle_invalid_connection
return nghttp2_session_inflate_handle_invalid_connection
(session, frame, NGHTTP2_PROTOCOL_ERROR);
}
}
......
......@@ -1480,11 +1480,17 @@ void test_nghttp2_session_on_push_promise_received(void)
CU_ASSERT(0 == user_data.begin_headers_cb_called);
CU_ASSERT(NULL == nghttp2_session_get_stream(session, 8));
item = nghttp2_session_get_next_ob_item(session);
CU_ASSERT(NGHTTP2_RST_STREAM == OB_CTRL_TYPE(item));
CU_ASSERT(8 == OB_CTRL(item)->hd.stream_id);
CU_ASSERT(NGHTTP2_REFUSED_STREAM == OB_CTRL(item)->rst_stream.error_code);
CU_ASSERT(NGHTTP2_GOAWAY == OB_CTRL_TYPE(item));
CU_ASSERT(0 == OB_CTRL(item)->hd.stream_id);
CU_ASSERT(NGHTTP2_PROTOCOL_ERROR == OB_CTRL(item)->goaway.error_code);
CU_ASSERT(0 == nghttp2_session_send(session));
nghttp2_session_del(session);
nghttp2_session_client_new(&session, &callbacks, &user_data);
memset(session->iframe.buf, 0, 4);
session->iframe.buflen = 4;
/* Same ID twice */
stream->state = NGHTTP2_STREAM_OPENING;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment