Code cleanup

This commit is contained in:
Tatsuhiro Tsujikawa 2014-01-20 00:01:10 +09:00
parent 16497d91c1
commit 594e1caad6
1 changed files with 5 additions and 14 deletions

View File

@ -2824,8 +2824,12 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session,
(session, frame, NGHTTP2_PROTOCOL_ERROR); (session, frame, NGHTTP2_PROTOCOL_ERROR);
} }
session->last_recv_stream_id = frame->push_promise.promised_stream_id; 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); 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); rv = session_skip_inflate_header_block(session, frame);
if(rv != 0) { if(rv != 0) {
return rv; return rv;
@ -2834,10 +2838,6 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session,
(session, frame->push_promise.promised_stream_id, (session, frame->push_promise.promised_stream_id,
NGHTTP2_REFUSED_STREAM); 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) { if(stream->shut_flags & NGHTTP2_SHUT_RD) {
rv = session_skip_inflate_header_block(session, frame); rv = session_skip_inflate_header_block(session, frame);
if(rv != 0) { if(rv != 0) {
@ -2853,15 +2853,6 @@ int nghttp2_session_on_push_promise_received(nghttp2_session *session,
(session, frame->push_promise.promised_stream_id, (session, frame->push_promise.promised_stream_id,
NGHTTP2_PROTOCOL_ERROR); 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 promised_stream = nghttp2_session_open_stream
(session, (session,
frame->push_promise.promised_stream_id, frame->push_promise.promised_stream_id,