diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index 89a33e51..f68e4d27 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -835,12 +835,12 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, auto sd = static_cast( nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!sd || !sd->dconn) { - break; + return 0; } auto downstream = sd->dconn->get_downstream(); if (!downstream || downstream->get_downstream_stream_id() != frame->hd.stream_id) { - break; + return 0; } auto upstream = downstream->get_upstream(); @@ -867,13 +867,13 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, } call_downstream_readcb(http2session, downstream); - break; + return 0; } case NGHTTP2_HEADERS: { auto sd = static_cast( nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)); if (!sd || !sd->dconn) { - break; + return 0; } auto downstream = sd->dconn->get_downstream(); @@ -922,7 +922,7 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, // This may delete downstream call_downstream_readcb(http2session, downstream); - break; + return 0; } case NGHTTP2_RST_STREAM: { auto sd = static_cast( @@ -937,14 +937,14 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, call_downstream_readcb(http2session, downstream); } } - break; + return 0; } case NGHTTP2_SETTINGS: if ((frame->hd.flags & NGHTTP2_FLAG_ACK) == 0) { - break; + return 0; } http2session->stop_settings_timer(); - break; + return 0; case NGHTTP2_PUSH_PROMISE: if (LOG_ENABLED(INFO)) { SSLOG(INFO, http2session) @@ -955,11 +955,10 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, // We just respond with RST_STREAM. http2session->submit_rst_stream(frame->push_promise.promised_stream_id, NGHTTP2_REFUSED_STREAM); - break; + return 0; default: - break; + return 0; } - return 0; } } // namespace diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index ccd40fde..dc131898 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -358,7 +358,7 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, downstream->set_request_state(Downstream::MSG_COMPLETE); } - break; + return 0; } case NGHTTP2_HEADERS: { auto downstream = upstream->find_downstream(frame->hd.stream_id); @@ -386,22 +386,14 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, } } - break; - } - case NGHTTP2_PRIORITY: { - // TODO comment out for now - // rv = downstream->change_priority(frame->priority.pri); - // if(rv != 0) { - // return NGHTTP2_ERR_CALLBACK_FAILURE; - // } - break; + return 0; } case NGHTTP2_SETTINGS: if ((frame->hd.flags & NGHTTP2_FLAG_ACK) == 0) { - break; + return 0; } upstream->stop_settings_timer(); - break; + return 0; case NGHTTP2_GOAWAY: if (LOG_ENABLED(INFO)) { auto debug_data = util::ascii_dump(frame->goaway.opaque_data, @@ -412,11 +404,10 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame, << ", error_code=" << frame->goaway.error_code << ", debug_data=" << debug_data; } - break; + return 0; default: - break; + return 0; } - return 0; } } // namespace @@ -464,7 +455,7 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, if ((frame->hd.flags & NGHTTP2_FLAG_ACK) == 0) { upstream->start_settings_timer(); } - break; + return 0; case NGHTTP2_PUSH_PROMISE: { auto downstream = make_unique( upstream, frame->push_promise.promised_stream_id, 0); @@ -508,7 +499,7 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, upstream->add_pending_downstream(std::move(downstream)); upstream->start_downstream(ptr); - break; + return 0; } case NGHTTP2_GOAWAY: if (LOG_ENABLED(INFO)) { @@ -520,9 +511,10 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame, << ", error_code=" << frame->goaway.error_code << ", debug_data=" << debug_data; } - break; + return 0; + default: + return 0; } - return 0; } } // namespace