From 010726a87582e3a7c01304f654d1acdbf5f87841 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 20 Dec 2015 23:20:14 +0900 Subject: [PATCH] Simplify error handling in nghttp2_session_on_headers_received return session_inflate_handle_invalid_stream(...) case is for streams for INITIAL state, but this is rare case. In general, we'd like to reduce RST_STREAM transmission, and it is suffice to ignore this frame for now. --- lib/nghttp2_session.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 04a24a14..0b3f8ec9 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -3593,15 +3593,9 @@ int nghttp2_session_on_headers_received(nghttp2_session *session, return rv; } return 0; - } else if (stream->state == NGHTTP2_STREAM_CLOSING) { - /* This is race condition. NGHTTP2_STREAM_CLOSING indicates - that we queued RST_STREAM but it has not been sent. It will - eventually sent, so we just ignore this frame. */ - return NGHTTP2_ERR_IGN_HEADER_BLOCK; - } else { - return session_inflate_handle_invalid_stream(session, frame, - NGHTTP2_ERR_PROTO); } + + return NGHTTP2_ERR_IGN_HEADER_BLOCK; } /* If this is remote peer initiated stream, it is OK unless it has sent END_STREAM frame already. But if stream is in