From 594e1caad67c87ec9495e517d6aef1eb5a1a6c2a Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 20 Jan 2014 00:01:10 +0900 Subject: [PATCH] Code cleanup --- lib/nghttp2_session.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 80fa8ce6..70dc364e 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -2824,8 +2824,12 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session, (session, frame, NGHTTP2_PROTOCOL_ERROR); } session->last_recv_stream_id = frame->push_promise.promised_stream_id; + if(!nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)) { + return nghttp2_session_inflate_handle_invalid_connection + (session, frame, NGHTTP2_PROTOCOL_ERROR); + } stream = nghttp2_session_get_stream(session, frame->hd.stream_id); - if(!stream) { + if(!stream || stream->state == NGHTTP2_STREAM_CLOSING) { rv = session_skip_inflate_header_block(session, frame); if(rv != 0) { return rv; @@ -2834,10 +2838,6 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session, (session, frame->push_promise.promised_stream_id, NGHTTP2_REFUSED_STREAM); } - if(!nghttp2_session_is_my_stream_id(session, frame->hd.stream_id)) { - return nghttp2_session_inflate_handle_invalid_connection - (session, frame, NGHTTP2_PROTOCOL_ERROR); - } if(stream->shut_flags & NGHTTP2_SHUT_RD) { rv = session_skip_inflate_header_block(session, frame); if(rv != 0) { @@ -2853,15 +2853,6 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session, (session, frame->push_promise.promised_stream_id, NGHTTP2_PROTOCOL_ERROR); } - if(stream->state == NGHTTP2_STREAM_CLOSING) { - rv = session_skip_inflate_header_block(session, frame); - if(rv != 0) { - return rv; - } - return nghttp2_session_add_rst_stream - (session, frame->push_promise.promised_stream_id, - NGHTTP2_REFUSED_STREAM); - } promised_stream = nghttp2_session_open_stream (session, frame->push_promise.promised_stream_id,