]> granicus.if.org Git - curl/commitdiff
Fixed checking the socket if there is data waiting in the cache
authorJiri Hruska <jirka@fud.cz>
Fri, 15 Feb 2013 15:42:49 +0000 (16:42 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Fri, 22 Feb 2013 20:23:25 +0000 (20:23 +0000)
Use Curl_pp_moredata() in Curl_pp_multi_statemach() to check if there is
more data to be received, rather than the socket state, as a task could
hang waiting for more data from the socket itself.

lib/pingpong.c

index 69834da7d02158da6e2f03be92e59ae72be51108..ec0047109a2ff8433c2555c72e344db5cebb89c0 100644 (file)
@@ -102,9 +102,13 @@ CURLcode Curl_pp_statemach(struct pingpong *pp, bool block)
   else
     interval_ms = 0; /* immediate */
 
-  rc = Curl_socket_ready(pp->sendleft?CURL_SOCKET_BAD:sock, /* reading */
-                         pp->sendleft?sock:CURL_SOCKET_BAD, /* writing */
-                         interval_ms);
+  if(Curl_pp_moredata(pp))
+    /* We are receiving and there is data in the cache so just read it */
+    rc = 1;
+  else
+    rc = Curl_socket_ready(pp->sendleft?CURL_SOCKET_BAD:sock, /* reading */
+                           pp->sendleft?sock:CURL_SOCKET_BAD, /* writing */
+                           interval_ms);
 
   if(block) {
     /* if we didn't wait, we don't have to spend time on this now */