diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index 8af4d2a7..a19a5112 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -454,11 +454,7 @@ typedef enum { /** * The ALTSVC extension frame. */ - NGHTTP2_EXT_ALTSVC = 0x0a, - /** - * The BLOCKED extension frame. - */ - NGHTTP2_EXT_BLOCKED = 0x0b + NGHTTP2_EXT_ALTSVC = 0x0a } nghttp2_ext_frame_type; /** @@ -962,9 +958,6 @@ typedef struct { * * If hd.type == :enum:`NGHTTP2_EXT_ALTSVC`, it is a pointer to * :type:`nghttp2_ext_altsvc`. - * - * If hd.type == :enum:`NGHTTP2_EXT_BLOCKED`, it points to ``NULL``, - * since BLOCKED extension frame has no payload. */ void *payload; } nghttp2_extension; diff --git a/lib/nghttp2_frame.c b/lib/nghttp2_frame.c index f8f73861..c48ba3e8 100644 --- a/lib/nghttp2_frame.c +++ b/lib/nghttp2_frame.c @@ -227,15 +227,6 @@ void nghttp2_frame_altsvc_free(nghttp2_extension *frame) free(altsvc->protocol_id); } -void nghttp2_frame_blocked_init(nghttp2_extension *frame, int32_t stream_id) -{ - frame_set_hd(&frame->hd, 0, NGHTTP2_EXT_BLOCKED, NGHTTP2_FLAG_NONE, - stream_id); -} - -void nghttp2_frame_blocked_free(nghttp2_extension *frame) -{} - void nghttp2_frame_data_init(nghttp2_data *frame, nghttp2_private_data *pdata) { frame->hd = pdata->hd; @@ -892,20 +883,6 @@ int nghttp2_frame_unpack_altsvc_payload(nghttp2_extension *frame, return 0; } -int nghttp2_frame_pack_blocked(nghttp2_bufs *bufs, nghttp2_extension *frame) -{ - nghttp2_buf *buf; - - assert(bufs->head == bufs->cur); - - buf = &bufs->head->buf; - buf->pos -= NGHTTP2_FRAME_HDLEN; - - nghttp2_frame_pack_frame_hd(buf->pos, &frame->hd); - - return 0; -} - nghttp2_settings_entry* nghttp2_frame_iv_copy(const nghttp2_settings_entry *iv, size_t niv) { diff --git a/lib/nghttp2_frame.h b/lib/nghttp2_frame.h index c398ceb3..950e6086 100644 --- a/lib/nghttp2_frame.h +++ b/lib/nghttp2_frame.h @@ -443,16 +443,6 @@ int nghttp2_frame_unpack_altsvc_payload(nghttp2_extension *frame, uint8_t *var_gift_payload, size_t var_gift_payloadlen); -/* - * Packs BLOCKED frame |frame| in wire format and store it in |bufs|. - * - * The caller must make sure that nghttp2_bufs_reset(bufs) is called - * before calling this function. - * - * This function always returns 0. - */ -int nghttp2_frame_pack_blocked(nghttp2_bufs *bufs, nghttp2_extension *frame); - /* * Initializes HEADERS frame |frame| with given values. |frame| takes * ownership of |nva|, so caller must not free it. If |stream_id| is @@ -548,10 +538,6 @@ void nghttp2_frame_altsvc_init(nghttp2_extension *frame, int32_t stream_id, */ void nghttp2_frame_altsvc_free(nghttp2_extension *frame); -void nghttp2_frame_blocked_init(nghttp2_extension *frame, int32_t stream_id); - -void nghttp2_frame_blocked_free(nghttp2_extension *frame); - void nghttp2_frame_data_init(nghttp2_data *frame, nghttp2_private_data *pdata); /* diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index afc2b275..ab280458 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -240,9 +240,6 @@ static void session_inbound_frame_reset(nghttp2_session *session) case NGHTTP2_EXT_ALTSVC: nghttp2_frame_altsvc_free(&iframe->frame.ext); break; - case NGHTTP2_EXT_BLOCKED: - nghttp2_frame_blocked_free(&iframe->frame.ext); - break; } memset(&iframe->frame, 0, sizeof(nghttp2_frame)); @@ -1291,41 +1288,6 @@ static int session_predicate_altsvc_send return 0; } -/* - * This function checks BLOCKED with the stream ID |stream_id| can be - * sent at this time. If |stream_id| is 0, BLOCKED frame is always - * allowed to send. - * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * NGHTTP2_ERR_STREAM_CLOSED - * The stream is already closed or does not exist. - * NGHTTP2_ERR_STREAM_CLOSING - * RST_STREAM was queued for this stream. - */ -static int session_predicate_blocked_send -(nghttp2_session *session, int32_t stream_id) -{ - nghttp2_stream *stream; - - if(stream_id == 0) { - return 0; - } - - stream = nghttp2_session_get_stream(session, stream_id); - - if(stream == NULL) { - return NGHTTP2_ERR_STREAM_CLOSED; - } - - if(stream->state == NGHTTP2_STREAM_CLOSING) { - return NGHTTP2_ERR_STREAM_CLOSING; - } - - return 0; -} - /* * This function checks SETTINGS can be sent at this time. * @@ -1480,71 +1442,6 @@ static int session_headers_add_pad(nghttp2_session *session, return 0; } -/* - * Adds BLOCKED frame to outbound queue. The |stream_id| could be 0, - * which means DATA is blocked by connection level flow control. - * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory - */ -static int session_add_blocked(nghttp2_session *session, int32_t stream_id) -{ - int rv; - nghttp2_frame *frame; - - frame = malloc(sizeof(nghttp2_frame)); - - if(frame == NULL) { - return NGHTTP2_ERR_NOMEM; - } - - frame->ext.payload = NULL; - - nghttp2_frame_blocked_init(&frame->ext, stream_id); - - rv = nghttp2_session_add_frame(session, NGHTTP2_CAT_CTRL, frame, NULL); - - if(rv != 0) { - nghttp2_frame_blocked_free(&frame->ext); - free(frame); - - return rv; - } - return 0; -} - -/* - * Adds BLOCKED frame(s) to outbound queue if they are allowed to - * send. We check BLOCKED frame can be sent for connection and stream - * individually. - * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * NGHTTP2_ERR_NOMEM - * Out of memory - */ -static int session_consider_blocked(nghttp2_session *session, - nghttp2_stream *stream) -{ - if(session->blocked_sent == 0 && session->remote_window_size <= 0) { - session->blocked_sent = 1; - - return session_add_blocked(session, 0); - } - - if(stream->blocked_sent == 0 && stream->remote_window_size <= 0) { - stream->blocked_sent = 1; - - return session_add_blocked(session, stream->stream_id); - } - - return 0; -} - /* * This function serializes frame for transmission. * @@ -1762,20 +1659,6 @@ static int session_prep_frame(nghttp2_session *session, return framerv; } - break; - case NGHTTP2_EXT_BLOCKED: - rv = session_predicate_blocked_send(session, frame->hd.stream_id); - if(rv != 0) { - return rv; - } - - framerv = nghttp2_frame_pack_blocked(&session->aob.framebufs, - &frame->ext); - - if(framerv < 0) { - return framerv; - } - break; default: return NGHTTP2_ERR_INVALID_ARGUMENT; @@ -1813,12 +1696,6 @@ static int session_prep_frame(nghttp2_session *session, next_readmax = nghttp2_session_next_data_read(session, stream); if(next_readmax == 0) { - rv = session_consider_blocked(session, stream); - - if(nghttp2_is_fatal(rv)) { - return rv; - } - rv = nghttp2_stream_defer_data(stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL, &session->ob_pq, session->last_cycle); @@ -2227,12 +2104,6 @@ static int session_after_frame_sent(nghttp2_session *session) next_readmax = nghttp2_session_next_data_read(session, stream); if(next_readmax == 0) { - rv = session_consider_blocked(session, stream); - - if(nghttp2_is_fatal(rv)) { - return rv; - } - rv = nghttp2_stream_defer_data (stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL, &session->ob_pq, session->last_cycle); @@ -3177,10 +3048,6 @@ static int update_remote_initial_window_size_func NGHTTP2_FLOW_CONTROL_ERROR); } - if(stream->remote_window_size > 0) { - stream->blocked_sent = 0; - } - /* If window size gets positive, push deferred DATA frame to outbound queue. */ if(nghttp2_stream_check_deferred_by_flow_control(stream) && @@ -3725,22 +3592,6 @@ static int session_process_altsvc_frame(nghttp2_session *session) return nghttp2_session_on_altsvc_received(session, frame); } -int nghttp2_session_on_blocked_received(nghttp2_session *session, - nghttp2_frame *frame) -{ - return session_call_on_frame_received(session, frame); -} - -static int session_process_blocked_frame(nghttp2_session *session) -{ - nghttp2_inbound_frame *iframe = &session->iframe; - nghttp2_frame *frame = &iframe->frame; - - frame->ext.payload = NULL; - - return nghttp2_session_on_blocked_received(session, frame); -} - static int push_back_deferred_data_func(nghttp2_map_entry *entry, void *ptr) { int rv; @@ -3789,7 +3640,6 @@ static int session_on_connection_window_update_received /* To queue the DATA deferred by connection-level flow-control, we have to check all streams. Bad. */ if(session->remote_window_size > 0) { - session->blocked_sent = 0; rv = session_push_back_deferred_data(session); if(rv != 0) { @@ -3825,10 +3675,6 @@ static int session_on_stream_window_update_received } stream->remote_window_size += frame->window_update.window_size_increment; - if(stream->remote_window_size > 0) { - stream->blocked_sent = 0; - } - if(stream->remote_window_size > 0 && session->remote_window_size > 0 && nghttp2_stream_check_deferred_by_flow_control(stream)) { @@ -4552,27 +4398,6 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, iframe->state = NGHTTP2_IB_READ_NBYTE; inbound_frame_set_mark(iframe, NGHTTP2_ALTSVC_FIXED_PARTLEN); - break; - case NGHTTP2_EXT_BLOCKED: - DEBUGF(fprintf(stderr, "recv: BLOCKED\n")); - - iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; - - if(iframe->payloadleft != 0) { - busy = 1; - - iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR; - - break; - } - - rv = session_process_blocked_frame(session); - if(nghttp2_is_fatal(rv)) { - return rv; - } - - session_inbound_frame_reset(session); - break; default: DEBUGF(fprintf(stderr, "recv: unknown frame\n")); diff --git a/lib/nghttp2_session.h b/lib/nghttp2_session.h index 6d6787b0..5ba7af5a 100644 --- a/lib/nghttp2_session.h +++ b/lib/nghttp2_session.h @@ -223,9 +223,6 @@ struct nghttp2_session { /* Flags indicating GOAWAY is sent and/or recieved. The flags are composed by bitwise OR-ing nghttp2_goaway_flag. */ uint8_t goaway_flags; - /* nonzero if blocked was sent and remote_window_size is still 0 or - negative */ - uint8_t blocked_sent; }; /* Struct used when updating initial window size of each active @@ -600,19 +597,6 @@ int nghttp2_session_on_window_update_received(nghttp2_session *session, int nghttp2_session_on_altsvc_received(nghttp2_session *session, nghttp2_frame *frame); -/* - * Called when BLOCKED is received, assuming |frame| is properly - * initialized. - * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * NGHTTP2_ERR_CALLBACK_FAILURE - * The callback function failed. - */ -int nghttp2_session_on_blocked_received(nghttp2_session *session, - nghttp2_frame *frame); - /* * Called when DATA is received, assuming |frame| is properly * initialized. diff --git a/src/app_helper.cc b/src/app_helper.cc index 98c84ca0..336fa013 100644 --- a/src/app_helper.cc +++ b/src/app_helper.cc @@ -129,8 +129,6 @@ const char* strframetype(uint8_t type) return "WINDOW_UPDATE"; case NGHTTP2_EXT_ALTSVC: return "ALTSVC"; - case NGHTTP2_EXT_BLOCKED: - return "BLOCKED"; default: return "UNKNOWN"; }