summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2021-08-09 22:21:38 +0900
committerDaniel Stenberg <daniel@haxx.se>2021-08-09 16:53:11 +0200
commit636006dd36933940f1d54497d3c377f49f2cd3f1 (patch)
treefd1473fdb41df8ca10a647652118729a7878410b
parentc4242b1e6e29f4362d9a87e8fb4f129402179897 (diff)
downloadcurl-636006dd36933940f1d54497d3c377f49f2cd3f1.tar.gz
ngtcp2: rework the return value handling of ngtcp2_conn_writev_stream
Rework the return value handling of ngtcp2_conn_writev_stream and treat NGTCP2_ERR_STREAM_SHUT_WR separately. Closes #7546
-rw-r--r--lib/vquic/ngtcp2.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/vquic/ngtcp2.c b/lib/vquic/ngtcp2.c
index 886a3ecd1..4ed07072b 100644
--- a/lib/vquic/ngtcp2.c
+++ b/lib/vquic/ngtcp2.c
@@ -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) {
@@ -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) {
@@ -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));