]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi: allow user callbacks to call curl_multi_assign
authorJay Satiro <raysatiro@yahoo.com>
Sun, 20 Feb 2022 21:04:07 +0000 (16:04 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Mon, 21 Feb 2022 08:23:12 +0000 (03:23 -0500)
Several years ago a change was made to block user callbacks from calling
back into the API when not supported (recursive calls). One of the calls
blocked was curl_multi_assign. Recently the blocking was extended to the
multi interface API, however curl_multi_assign may need to be called
from within those user callbacks (eg CURLMOPT_SOCKETFUNCTION).

I can't think of any callback where it would be unsafe to call
curl_multi_assign so I removed the restriction entirely.

Reported-by: Michael Wallner
Ref: https://github.com/curl/curl/commit/b46cfbc
Ref: https://github.com/curl/curl/commit/340bb19

Fixes https://github.com/curl/curl/issues/8480
Closes https://github.com/curl/curl/pull/8483

docs/libcurl/curl_multi_assign.3
lib/multi.c

index 70a00f884e31c3b93288255b77af91f25818cb38..8961dc3c206c363a9820738ad031571852bde3e1 100644 (file)
@@ -48,6 +48,8 @@ The idea here being that this association (socket to private pointer) is
 something that just about every application that uses this API will need and
 then libcurl can just as well do it since it already has an internal hash
 table lookup for this.
+
+It is acceptable to call this function from your multi callback functions.
 .SH EXAMPLE
 .nf
  /* make our struct pointer associated with socket fd */
index 0b76874cd45d1c9810e7a1ba795aedff5af82c44..6fdeafb8e6a07d7de77701bdfbaa5ac65ba98882 100644 (file)
@@ -3571,9 +3571,6 @@ CURLMcode curl_multi_assign(struct Curl_multi *multi, curl_socket_t s,
 {
   struct Curl_sh_entry *there = NULL;
 
-  if(multi->in_callback)
-    return CURLM_RECURSIVE_API_CALL;
-
   there = sh_getentry(&multi->sockhash, s);
 
   if(!there)