void h2o_http2_stream_reset(h2o_http2_conn_t *conn, h2o_http2_stream_t *stream) { switch (stream->state) { case H2O_HTTP2_STREAM_STATE_IDLE: case H2O_HTTP2_STREAM_STATE_RECV_HEADERS: case H2O_HTTP2_STREAM_STATE_RECV_BODY: case H2O_HTTP2_STREAM_STATE_REQ_PENDING: h2o_http2_stream_close(conn, stream); break; case H2O_HTTP2_STREAM_STATE_SEND_HEADERS: case H2O_HTTP2_STREAM_STATE_SEND_BODY: case H2O_HTTP2_STREAM_STATE_SEND_BODY_IS_FINAL: h2o_http2_stream_set_state(conn, stream, H2O_HTTP2_STREAM_STATE_END_STREAM); /* continues */ case H2O_HTTP2_STREAM_STATE_END_STREAM: /* clear all the queued bufs, and close the connection in the callback */ stream->_data.size = 0; if (h2o_linklist_is_linked(&stream->_refs.link)) { /* will be closed in the callback */ } else { h2o_http2_stream_close(conn, stream); } break; } }
static void close_connection_now(h2o_http2_conn_t *conn) { h2o_http2_stream_t *stream; assert(!h2o_timeout_is_linked(&conn->_write.timeout_entry)); kh_foreach_value(conn->streams, stream, { h2o_http2_stream_close(conn, stream); });
void h2o_http2_stream_proceed(h2o_http2_conn_t *conn, h2o_http2_stream_t *stream) { if (stream->state == H2O_HTTP2_STREAM_STATE_END_STREAM) { h2o_http2_stream_close(conn, stream); } else { h2o_proceed_response(&stream->req); } }
void h2o_http2_stream_reset(h2o_http2_conn_t *conn, h2o_http2_stream_t *stream, int errnum) { switch (stream->state) { case H2O_HTTP2_STREAM_STATE_RECV_PSUEDO_HEADERS: case H2O_HTTP2_STREAM_STATE_RECV_HEADERS: case H2O_HTTP2_STREAM_STATE_RECV_BODY: case H2O_HTTP2_STREAM_STATE_REQ_PENDING: h2o_http2_stream_close(conn, stream); break; case H2O_HTTP2_STREAM_STATE_SEND_HEADERS: case H2O_HTTP2_STREAM_STATE_SEND_BODY: case H2O_HTTP2_STREAM_STATE_END_STREAM: /* change the state to EOS, clear all the queued bufs, and close the connection in the callback */ stream->state = H2O_HTTP2_STREAM_STATE_END_STREAM; stream->_data.size = 0; if (h2o_linklist_is_linked(&stream->_link.link)) { /* will be closed in the callback */ } else { h2o_http2_stream_close(conn, stream); } break; } }