From 802b2aaf6a5e640b868dc47b53df13a7d931cc5e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 15 Jan 2006 23:17:46 +0000 Subject: adjusted to use curl_multi_setopt() to set the callback --- hiper/shiper.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'hiper') diff --git a/hiper/shiper.c b/hiper/shiper.c index 37fc0b321..dc78c6478 100644 --- a/hiper/shiper.c +++ b/hiper/shiper.c @@ -104,7 +104,8 @@ static struct fdinfo *findsock(curl_socket_t s) static void remsock(curl_socket_t s) { - struct fdinfo *fdp; + struct fdinfo *fdp = allsocks; + while(fdp) { if(fdp->sockfd == s) break; @@ -437,7 +438,7 @@ int main(int argc, char **argv) curl_easy_setopt(e, CURLOPT_URL, conns[i].url); curl_easy_setopt(e, CURLOPT_WRITEFUNCTION, writecallback); curl_easy_setopt(e, CURLOPT_WRITEDATA, &conns[i]); - curl_easy_setopt(e, CURLOPT_VERBOSE, 1); + curl_easy_setopt(e, CURLOPT_VERBOSE, 0); curl_easy_setopt(e, CURLOPT_ERRORBUFFER, conns[i].error); curl_easy_setopt(e, CURLOPT_PRIVATE, &conns[i]); @@ -448,9 +449,11 @@ int main(int argc, char **argv) } } + curl_multi_setopt(multi_handle, CURLMOPT_SOCKETFUNCTION, socket_callback); + curl_multi_setopt(multi_handle, CURLMOPT_SOCKETDATA, NULL); + /* we start the action by calling *socket() right away */ - while(CURLM_CALL_MULTI_PERFORM == - curl_multi_socket_all(multi_handle, socket_callback, NULL)); + while(CURLM_CALL_MULTI_PERFORM == curl_multi_socket_all(multi_handle)); printf("Starting timer, expects to run for %ldus\n", RUN_FOR_THIS_LONG); timer_start(); @@ -485,8 +488,7 @@ int main(int argc, char **argv) break; case 0: timeouts++; - curl_multi_socket(multi_handle, CURL_SOCKET_TIMEOUT, socket_callback, - NULL); + curl_multi_socket(multi_handle, CURL_SOCKET_TIMEOUT); break; default: @@ -510,7 +512,7 @@ int main(int argc, char **argv) timer_continue(); if(act & CURL_POLL_OUT) act--; - curl_multi_socket(multi_handle, fdp->sockfd, socket_callback, NULL); + curl_multi_socket(multi_handle, fdp->sockfd); timer_pause(); } } -- cgit v1.2.3