Merge pull request #1764 from nghttp2/h3-ignore-errors

Ignore nghttp3 errors which can be ignored
This commit is contained in:
Tatsuhiro Tsujikawa 2022-07-26 00:40:11 +09:00 committed by GitHub
commit 75a0d090df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 44 deletions

View File

@ -391,26 +391,12 @@ ssize_t Http3Session::write_stream(int64_t &stream_id, int &fin,
return sveccnt; return sveccnt;
} }
int Http3Session::block_stream(int64_t stream_id) { void Http3Session::block_stream(int64_t stream_id) {
auto rv = nghttp3_conn_block_stream(conn_, stream_id); nghttp3_conn_block_stream(conn_, stream_id);
if (rv != 0) {
ngtcp2_connection_close_error_set_application_error(
&client_->quic.last_error, nghttp3_err_infer_quic_app_error_code(rv),
nullptr, 0);
return -1;
}
return 0;
} }
int Http3Session::shutdown_stream_write(int64_t stream_id) { void Http3Session::shutdown_stream_write(int64_t stream_id) {
auto rv = nghttp3_conn_shutdown_stream_write(conn_, stream_id); nghttp3_conn_shutdown_stream_write(conn_, stream_id);
if (rv != 0) {
ngtcp2_connection_close_error_set_application_error(
&client_->quic.last_error, nghttp3_err_infer_quic_app_error_code(rv),
nullptr, 0);
return -1;
}
return 0;
} }
int Http3Session::add_write_offset(int64_t stream_id, size_t ndatalen) { int Http3Session::add_write_offset(int64_t stream_id, size_t ndatalen) {

View File

@ -62,8 +62,8 @@ public:
size_t datalen); size_t datalen);
ssize_t write_stream(int64_t &stream_id, int &fin, nghttp3_vec *vec, ssize_t write_stream(int64_t &stream_id, int &fin, nghttp3_vec *vec,
size_t veccnt); size_t veccnt);
int block_stream(int64_t stream_id); void block_stream(int64_t stream_id);
int shutdown_stream_write(int64_t stream_id); void shutdown_stream_write(int64_t stream_id);
int add_write_offset(int64_t stream_id, size_t ndatalen); int add_write_offset(int64_t stream_id, size_t ndatalen);
int add_ack_offset(int64_t stream_id, size_t datalen); int add_ack_offset(int64_t stream_id, size_t datalen);

View File

@ -637,15 +637,11 @@ int Client::write_quic() {
switch (nwrite) { switch (nwrite) {
case NGTCP2_ERR_STREAM_DATA_BLOCKED: case NGTCP2_ERR_STREAM_DATA_BLOCKED:
assert(ndatalen == -1); assert(ndatalen == -1);
if (s->block_stream(stream_id) != 0) { s->block_stream(stream_id);
return -1;
}
continue; continue;
case NGTCP2_ERR_STREAM_SHUT_WR: case NGTCP2_ERR_STREAM_SHUT_WR:
assert(ndatalen == -1); assert(ndatalen == -1);
if (s->shutdown_stream_write(stream_id) != 0) { s->shutdown_stream_write(stream_id);
return -1;
}
continue; continue;
case NGTCP2_ERR_WRITE_MORE: case NGTCP2_ERR_WRITE_MORE:
assert(ndatalen >= 0); assert(ndatalen >= 0);

View File

@ -798,27 +798,11 @@ int Http3Upstream::write_streams() {
switch (nwrite) { switch (nwrite) {
case NGTCP2_ERR_STREAM_DATA_BLOCKED: case NGTCP2_ERR_STREAM_DATA_BLOCKED:
assert(ndatalen == -1); assert(ndatalen == -1);
rv = nghttp3_conn_block_stream(httpconn_, stream_id); nghttp3_conn_block_stream(httpconn_, stream_id);
if (rv != 0) {
ULOG(ERROR, this)
<< "nghttp3_conn_block_stream: " << nghttp3_strerror(rv);
ngtcp2_connection_close_error_set_application_error(
&last_error_, nghttp3_err_infer_quic_app_error_code(rv), nullptr,
0);
return handle_error();
}
continue; continue;
case NGTCP2_ERR_STREAM_SHUT_WR: case NGTCP2_ERR_STREAM_SHUT_WR:
assert(ndatalen == -1); assert(ndatalen == -1);
rv = nghttp3_conn_shutdown_stream_write(httpconn_, stream_id); nghttp3_conn_shutdown_stream_write(httpconn_, stream_id);
if (rv != 0) {
ULOG(ERROR, this)
<< "nghttp3_conn_shutdown_stream_write: " << nghttp3_strerror(rv);
ngtcp2_connection_close_error_set_application_error(
&last_error_, nghttp3_err_infer_quic_app_error_code(rv), nullptr,
0);
return handle_error();
}
continue; continue;
case NGTCP2_ERR_WRITE_MORE: case NGTCP2_ERR_WRITE_MORE:
assert(ndatalen >= 0); assert(ndatalen >= 0);