Handle stream limit increment

This commit is contained in:
Tatsuhiro Tsujikawa 2020-02-12 11:22:19 +09:00
parent 987e700f36
commit 245dbd6511
2 changed files with 15 additions and 3 deletions

View File

@ -113,6 +113,10 @@ int stream_close(nghttp3_conn *conn, int64_t stream_id, uint64_t app_error_code,
} // namespace
int Http3Session::stream_close(int64_t stream_id, uint64_t app_error_code) {
if (!ngtcp2_is_bidi_stream(stream_id)) {
assert(!ngtcp2_conn_is_local_stream(client_->quic.conn, stream_id));
ngtcp2_conn_extend_max_streams_uni(client_->quic.conn, 1);
}
client_->on_stream_close(stream_id, app_error_code == NGHTTP3_H3_NO_ERROR);
return 0;
}
@ -208,10 +212,18 @@ int Http3Session::send_stop_sending(int64_t stream_id,
int Http3Session::close_stream(int64_t stream_id, uint64_t app_error_code) {
auto rv = nghttp3_conn_close_stream(conn_, stream_id, app_error_code);
if (rv != 0) {
return -1;
switch (rv) {
case 0:
return 0;
case NGHTTP3_ERR_STREAM_NOT_FOUND:
if (!ngtcp2_is_bidi_stream(stream_id)) {
assert(!ngtcp2_conn_is_local_stream(client_->quic.conn, stream_id));
ngtcp2_conn_extend_max_streams_uni(client_->quic.conn, 1);
}
return 0;
default:
return -1;
}
}
int Http3Session::reset_stream(int64_t stream_id) {

@ -1 +1 @@
Subproject commit 5cf5da80b715223d2614374aec40f2663dc68d6a
Subproject commit b967ca054f48a36f82d8fcdd32e54ec5144f2751