aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJiri Hruska <jirka@fud.cz>2013-02-15 16:42:49 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-02-22 20:23:25 +0000
commit296b9a5af0c0de3f5b3d78a85a6ace8cdc9647f1 (patch)
treeb1cd0387809a9ee27469eee246fce5f659391fca /lib
parent1dac29fa83a9ed1285faa7e06d42c7b4ffd98a62 (diff)
Fixed checking the socket if there is data waiting in the cache
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/pingpong.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/pingpong.c b/lib/pingpong.c
index 69834da7d..ec0047109 100644
--- a/lib/pingpong.c
+++ b/lib/pingpong.c
@@ -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 */