Curl_single_getsock: fix hold/pause sock handling
authorCarlo Wood <carlo@alinoe.com>
Sun, 2 Nov 2014 13:09:00 +0000 (14:09 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 3 Nov 2014 08:40:13 +0000 (09:40 +0100)
The previous condition that checked if the socket was marked as readable
when also adding a writable one, was incorrect and didn't take the pause
bits properly into account.

lib/transfer.c

index 6d4ad43fa16e7f2e8c4bbcea10f47d7a033800b2..b48dfce848eb99c32c93a7098f86ab6162f51cdd 100644 (file)
@@ -1214,10 +1214,10 @@ int Curl_single_getsock(const struct connectdata *conn,
   if((data->req.keepon & KEEP_SENDBITS) == KEEP_SEND) {
 
     if((conn->sockfd != conn->writesockfd) ||
-       !(data->req.keepon & KEEP_RECV)) {
-      /* only if they are not the same socket or we didn't have a readable
+       bitmap == GETSOCK_BLANK) {
+      /* only if they are not the same socket and we have a readable
          one, we increase index */
-      if(data->req.keepon & KEEP_RECV)
+      if(bitmap != GETSOCK_BLANK)
         sockindex++; /* increase index if we need two entries */
 
       DEBUGASSERT(conn->writesockfd != CURL_SOCKET_BAD);