aboutsummaryrefslogtreecommitdiff
path: root/lib/multi.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-07-26 22:19:42 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-07-26 22:19:42 +0000
commit6f6b93da02019141812b81bfdbb6bcda430c3b4d (patch)
treeb7c63e529d88edfbfebd5aaeb4570bd26f2b1cef /lib/multi.c
parent45b1843dc9d5b283e5fd892dd74415e0e2a426a7 (diff)
[Hiper-related work] Added a function called curl_multi_assign() that will
set a private pointer added to the internal libcurl hash table for the particular socket passed in to this function.
Diffstat (limited to 'lib/multi.c')
-rw-r--r--lib/multi.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 44c742476..3296f09e5 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -182,7 +182,7 @@ struct Curl_sh_entry {
time_t timestamp;
long inuse;
int action; /* what action READ/WRITE this socket waits for */
- void *userp; /* settable by users (not yet decided exactly how) */
+ void *socketp; /* settable by users with curl_multi_assign() */
};
/* bits for 'action' having no bits means this socket is not expecting any
action */
@@ -1125,10 +1125,14 @@ static void singlesocket(struct Curl_multi *multi,
/* call the callback with this new info */
if(multi->socket_cb) {
+ struct Curl_sh_entry *entry =
+ Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(s));
+
multi->socket_cb(easy->easy_handle,
s,
action,
- multi->socket_userp);
+ multi->socket_userp,
+ entry->socketp);
}
/* Update the sockhash accordingly */
@@ -1385,3 +1389,19 @@ void Curl_expire(struct SessionHandle *data, long milli)
#endif
}
+CURLMcode curl_multi_assign(CURLM *multi_handle,
+ curl_socket_t s, void *hashp)
+{
+ struct Curl_sh_entry *there = NULL;
+ struct Curl_multi *multi = (struct Curl_multi *)multi_handle;
+
+ if(s != CURL_SOCKET_BAD)
+ there = Curl_hash_pick(multi->sockhash, (char *)&s, sizeof(curl_socket_t));
+
+ if(!there)
+ return CURLM_BAD_SOCKET;
+
+ there->socketp = hashp;
+
+ return CURLM_OK;
+}