aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2016-04-12 00:37:44 -0400
committerJay Satiro <raysatiro@yahoo.com>2016-04-12 00:37:44 -0400
commit3f57880ad10d3c98891266766c4423d938ee1821 (patch)
tree1f3bc59d1ac3a2a3ec3b794fa72595a7201fa6c3
parent723f90119512fa29b8b407d296e01219c4ead04f (diff)
http2: Use size_t type for data drain count
Ref: https://github.com/curl/curl/issues/659 Ref: https://github.com/curl/curl/pull/663
-rw-r--r--lib/http.h2
-rw-r--r--lib/http2.c2
-rw-r--r--lib/urldata.h6
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/http.h b/lib/http.h
index 8aae35206..981472e07 100644
--- a/lib/http.h
+++ b/lib/http.h
@@ -214,7 +214,7 @@ struct http_conn {
them for both cases. */
int32_t pause_stream_id; /* stream ID which paused
nghttp2_session_mem_recv */
- int drain_total; /* sum of all stream's UrlState.drain */
+ size_t drain_total; /* sum of all stream's UrlState.drain */
/* this is a hash of all individual streams (SessionHandle structs) */
struct h2settings settings;
diff --git a/lib/http2.c b/lib/http2.c
index 1f4c6ffcc..eae8dac8d 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -1166,6 +1166,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;
@@ -1471,6 +1472,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 */
}
diff --git a/lib/urldata.h b/lib/urldata.h
index 78593eecc..0efb65160 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1314,9 +1314,9 @@ struct UrlState {
curl_off_t infilesize; /* size of file to upload, -1 means unknown.
Copied from set.filesize at start of operation */
- int drain; /* Increased when this stream has data to read, even if its
- socket not necessarily is readable. Decreased when
- checked. */
+ size_t drain; /* Increased when this stream has data to read, even if its
+ socket is not necessarily is readable. Decreased when
+ checked. */
bool done; /* set to FALSE when Curl_do() is called and set to TRUE when
Curl_done() is called, to prevent Curl_done() to get invoked
twice when the multi interface is used. */