]> granicus.if.org Git - curl/commitdiff
http2: Use size_t type for data drain count
authorJay Satiro <raysatiro@yahoo.com>
Tue, 12 Apr 2016 04:37:44 +0000 (00:37 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Tue, 12 Apr 2016 04:37:44 +0000 (00:37 -0400)
Ref: https://github.com/curl/curl/issues/659
Ref: https://github.com/curl/curl/pull/663

lib/http.h
lib/http2.c
lib/urldata.h

index 8aae3520698de2d0ef44a3472c632d442d8e6e9a..981472e073e97c6b3ed4f33619920d59af131f47 100644 (file)
@@ -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;
index 1f4c6ffcce21c23348123a402c86cd7d97ba7201..eae8dac8d2e5607d601d8c2086d4c0f5eebdbc32 100644 (file)
@@ -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 */
     }
index 78593eecc1050130c06972ff5c4e041fe3e26f5f..0efb65160334bf71caeacb80eea6d6659b141d0b 100644 (file)
@@ -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. */