[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 44/153: http2: clear the drain counter in Curl_http
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 44/153: http2: clear the drain counter in Curl_http2_done |
Date: |
Tue, 11 Sep 2018 12:51:55 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit c3b297466deb57016b2f6742df23062c4d611cf4
Author: Daniel Stenberg <address@hidden>
AuthorDate: Sun Jul 29 12:30:29 2018 +0200
http2: clear the drain counter in Curl_http2_done
Reported-by: Andrei Virtosu
Fixes #2800
Closes #2809
---
lib/http2.c | 43 ++++++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 13 deletions(-)
diff --git a/lib/http2.c b/lib/http2.c
index 6511451af..ae5fa4a11 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -444,6 +444,28 @@ char *curl_pushheader_byname(struct curl_pushheaders *h,
const char *header)
return NULL;
}
+/*
+ * This specific transfer on this connection has been "drained".
+ */
+static void drained_transfer(struct Curl_easy *data,
+ struct http_conn *httpc)
+{
+ DEBUGASSERT(httpc->drain_total >= data->state.drain);
+ httpc->drain_total -= data->state.drain;
+ data->state.drain = 0;
+}
+
+/*
+ * Mark this transfer to get "drained".
+ */
+static void drain_this(struct Curl_easy *data,
+ struct http_conn *httpc)
+{
+ data->state.drain++;
+ httpc->drain_total++;
+ DEBUGASSERT(httpc->drain_total >= data->state.drain);
+}
+
static struct Curl_easy *duphandle(struct Curl_easy *data)
{
struct Curl_easy *second = curl_easy_duphandle(data);
@@ -658,8 +680,7 @@ static int on_frame_recv(nghttp2_session *session, const
nghttp2_frame *frame,
stream->len -= ncopy;
stream->memlen += ncopy;
- data_s->state.drain++;
- httpc->drain_total++;
+ drain_this(data_s, httpc);
{
/* get the pointer from userp again since it was re-assigned above */
struct connectdata *conn_s = (struct connectdata *)userp;
@@ -738,8 +759,7 @@ static int on_data_chunk_recv(nghttp2_session *session,
uint8_t flags,
stream->len -= nread;
stream->memlen += nread;
- data_s->state.drain++;
- conn->proto.httpc.drain_total++;
+ drain_this(data_s, &conn->proto.httpc);
/* if we receive data for another handle, wake that up */
if(conn->data != data_s)
@@ -845,9 +865,8 @@ static int on_stream_close(nghttp2_session *session,
int32_t stream_id,
return NGHTTP2_ERR_CALLBACK_FAILURE;
stream->closed = TRUE;
- data_s->state.drain++;
httpc = &conn->proto.httpc;
- httpc->drain_total++;
+ drain_this(data_s, httpc);
httpc->error_code = error_code;
/* remove the entry from the hash as the stream is now gone */
@@ -1114,6 +1133,9 @@ void Curl_http2_done(struct connectdata *conn, bool
premature)
struct HTTP *http = data->req.protop;
struct http_conn *httpc = &conn->proto.httpc;
+ if(data->state.drain)
+ drained_transfer(data, httpc);
+
if(http->header_recvbuf) {
Curl_add_buffer_free(http->header_recvbuf);
http->header_recvbuf = NULL; /* clear the pointer */
@@ -1357,7 +1379,6 @@ CURLcode Curl_http2_done_sending(struct connectdata *conn)
return result;
}
-
static ssize_t http2_handle_stream_close(struct connectdata *conn,
struct Curl_easy *data,
struct HTTP *stream, CURLcode *err)
@@ -1370,9 +1391,7 @@ static ssize_t http2_handle_stream_close(struct
connectdata *conn,
httpc->pause_stream_id = 0;
}
- DEBUGASSERT(httpc->drain_total >= data->state.drain);
- httpc->drain_total -= data->state.drain;
- data->state.drain = 0;
+ drained_transfer(data, httpc);
if(httpc->pause_stream_id == 0) {
if(h2_process_pending_input(conn, httpc, err) != 0) {
@@ -1683,9 +1702,7 @@ static ssize_t http2_recv(struct connectdata *conn, int
sockindex,
stream->stream_id));
}
else if(!stream->closed) {
- DEBUGASSERT(httpc->drain_total >= data->state.drain);
- httpc->drain_total -= data->state.drain;
- data->state.drain = 0; /* this stream is hereby drained */
+ drained_transfer(data, httpc);
}
return retlen;
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 46/153: curl: use Content-Disposition before the "URL end" for -OJ, (continued)
- [GNUnet-SVN] [gnurl] 46/153: curl: use Content-Disposition before the "URL end" for -OJ, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 29/153: docs/CURLOPT_WRITEFUNCTION: size is always 1, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 58/153: cmake: bumped minimum version to 3.4, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 26/153: system_win32: fix version checking, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 56/153: travis: build darwinssl on macos 10.12, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 25/153: auth: pick Bearer authentication whenever a token is available, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 45/153: retry: return error if rewind was necessary but didn't happen, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 53/153: hostip: fix unused variable warning, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 47/153: HTTP: Don't attempt to needlessly decompress redirect body, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 23/153: test320: treat curl320.out file as binary, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 44/153: http2: clear the drain counter in Curl_http2_done,
gnunet <=
- [GNUnet-SVN] [gnurl] 01/153: examples/crawler.c: move #ifdef to column 0, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 24/153: auth: only ever pick CURLAUTH_BEARER if we *have* a Bearer token, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 37/153: TODO: Support Authority Information Access certificate extension (AIA), gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 35/153: test1157: test -H from empty file, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 39/153: test1157: follow-up to 35ecffb9, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 40/153: sws: handle EINTR when calling select(), gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 05/153: ares: check for NULL in completed-callback, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 28/153: wolfSSL/CyaSSL: Fix memory leak in Curl_cyassl_random, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 43/153: smb: fix memory leak on early failure, gnunet, 2018/09/11
- [GNUnet-SVN] [gnurl] 16/153: RELEASE-NOTES: sync, gnunet, 2018/09/11