Skip to content

Commit

Permalink
ngtcp2: rework the return value handling of ngtcp2_conn_writev_stream
Browse files Browse the repository at this point in the history
Rework the return value handling of ngtcp2_conn_writev_stream and treat
NGTCP2_ERR_STREAM_SHUT_WR separately.

Closes #7546
  • Loading branch information
tatsuhiro-t authored and bagder committed Aug 9, 2021
1 parent c4242b1 commit 636006d
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/vquic/ngtcp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1834,8 +1834,8 @@ static CURLcode ng_flush_egress(struct Curl_easy *data,
break;
}
if(outlen < 0) {
if(outlen == NGTCP2_ERR_STREAM_DATA_BLOCKED ||
outlen == NGTCP2_ERR_STREAM_SHUT_WR) {
switch(outlen) {
case NGTCP2_ERR_STREAM_DATA_BLOCKED:
assert(ndatalen == -1);
rv = nghttp3_conn_block_stream(qs->h3conn, stream_id);
if(rv) {
Expand All @@ -1844,8 +1844,17 @@ static CURLcode ng_flush_egress(struct Curl_easy *data,
return CURLE_SEND_ERROR;
}
continue;
}
else if(outlen == NGTCP2_ERR_WRITE_MORE) {
case NGTCP2_ERR_STREAM_SHUT_WR:
assert(ndatalen == -1);
rv = nghttp3_conn_shutdown_stream_write(qs->h3conn, stream_id);
if(rv) {
failf(data,
"nghttp3_conn_shutdown_stream_write returned error: %s\n",
nghttp3_strerror(rv));
return CURLE_SEND_ERROR;
}
continue;
case NGTCP2_ERR_WRITE_MORE:
assert(ndatalen >= 0);
rv = nghttp3_conn_add_write_offset(qs->h3conn, stream_id, ndatalen);
if(rv) {
Expand All @@ -1854,8 +1863,7 @@ static CURLcode ng_flush_egress(struct Curl_easy *data,
return CURLE_SEND_ERROR;
}
continue;
}
else {
default:
assert(ndatalen == -1);
failf(data, "ngtcp2_conn_writev_stream returned error: %s",
ngtcp2_strerror((int)outlen));
Expand Down

0 comments on commit 636006d

Please sign in to comment.