]> granicus.if.org Git - curl/commitdiff
readwrite_data: set a max number of loops
authorDaniel Stenberg <daniel@haxx.se>
Sun, 27 Sep 2015 18:48:35 +0000 (20:48 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 27 Sep 2015 18:48:35 +0000 (20:48 +0200)
... as otherwise a really fast pipe can "lock" one transfer for some
protocols, like with HTTP/2.

lib/transfer.c

index 191523c8b26a3242c6f5d78974977b56b0a3f661..7bc500cc8548861e43b60b61f336f91dd0d7a032 100644 (file)
@@ -399,6 +399,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
   size_t excess = 0; /* excess bytes read */
   bool is_empty_data = FALSE;
   bool readmore = FALSE; /* used by RTP to signal for more data */
+  int maxloops = 100;
 
   *done = FALSE;
 
@@ -794,7 +795,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
       k->keepon &= ~KEEP_RECV;
     }
 
-  } while(data_pending(conn));
+  } while(data_pending(conn) && maxloops--);
 
   if(((k->keepon & (KEEP_RECV|KEEP_SEND)) == KEEP_SEND) &&
      conn->bits.close ) {