]> granicus.if.org Git - curl/commitdiff
pause: when changing pause state, update socket state
authorDaniel Stenberg <daniel@haxx.se>
Fri, 16 Mar 2018 11:03:52 +0000 (12:03 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 16 Mar 2018 22:41:55 +0000 (23:41 +0100)
Especially unpausing a transfer might have to move the socket back to the
"currently used sockets" hash to get monitored. Otherwise it would never get
any more data and get stuck. Easily triggered with pausing using the
multi_socket API.

Reported-by: Philip Prindeville
Bug: https://curl.haxx.se/mail/lib-2018-03/0048.html
Fixes #2393
Closes #2391

lib/easy.c
lib/multi.c
lib/multiif.h

index 64c647be2f39eeb03d9b6be8a0b870f99bb85c77..fa34c3827933aa10926aa12940598c5ac07a1650 100644 (file)
@@ -1099,6 +1099,10 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
       (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) )
     Curl_expire(data, 0, EXPIRE_RUN_NOW); /* get this handle going again */
 
+  /* This transfer may have been moved in or out of the bundle, update
+     the corresponding socket callback, if used */
+  Curl_updatesocket(data);
+
   return result;
 }
 
index 69df902882ddf03a2f34a49936e895dfcf18d3e7..2f139ab37f1a88fecc485ea87b561eacbae6619d 100644 (file)
@@ -2421,6 +2421,12 @@ static void singlesocket(struct Curl_multi *multi,
   data->numsocks = num;
 }
 
+void Curl_updatesocket(struct Curl_easy *data)
+{
+  singlesocket(data->multi, data);
+}
+
+
 /*
  * Curl_multi_closed()
  *
index a988bfd4a2b08aead067eb9c5a329c62c97e26b7..b9c722aed5879f23eaa0ba6ec0ba8d070bb377db 100644 (file)
@@ -7,7 +7,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -26,6 +26,7 @@
  * Prototypes for library-wide functions provided by multi.c
  */
 
+void Curl_updatesocket(struct Curl_easy *data);
 void Curl_expire(struct Curl_easy *data, time_t milli, expire_id);
 void Curl_expire_clear(struct Curl_easy *data);
 void Curl_expire_done(struct Curl_easy *data, expire_id id);