[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 142/173: docs: fix timeout handling in multi-uv exa
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 142/173: docs: fix timeout handling in multi-uv example |
Date: |
Fri, 24 Feb 2017 14:02:44 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.53.1
in repository gnurl.
commit 4ddf9798ab1ae0c6d18d8f12ce531991dbd2575a
Author: Michael Kaufmann <address@hidden>
AuthorDate: Sun Jan 29 17:06:49 2017 +0100
docs: fix timeout handling in multi-uv example
---
docs/examples/multi-uv.c | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/docs/examples/multi-uv.c b/docs/examples/multi-uv.c
index c0228945d..406a5e062 100644
--- a/docs/examples/multi-uv.c
+++ b/docs/examples/multi-uv.c
@@ -46,7 +46,7 @@ typedef struct curl_context_s {
curl_socket_t sockfd;
} curl_context_t;
-curl_context_t* create_curl_context(curl_socket_t sockfd)
+static curl_context_t* create_curl_context(curl_socket_t sockfd)
{
curl_context_t *context;
@@ -60,18 +60,18 @@ curl_context_t* create_curl_context(curl_socket_t sockfd)
return context;
}
-void curl_close_cb(uv_handle_t *handle)
+static void curl_close_cb(uv_handle_t *handle)
{
curl_context_t *context = (curl_context_t *) handle->data;
free(context);
}
-void destroy_curl_context(curl_context_t *context)
+static void destroy_curl_context(curl_context_t *context)
{
uv_close((uv_handle_t *) &context->poll_handle, curl_close_cb);
}
-void add_download(const char *url, int num)
+static void add_download(const char *url, int num)
{
char filename[50];
FILE *file;
@@ -129,14 +129,12 @@ static void check_multi_info(void)
}
}
-void curl_perform(uv_poll_t *req, int status, int events)
+static void curl_perform(uv_poll_t *req, int status, int events)
{
int running_handles;
int flags = 0;
curl_context_t *context;
- uv_timer_stop(&timeout);
-
if(events & UV_READABLE)
flags |= CURL_CSELECT_IN;
if(events & UV_WRITABLE)
@@ -150,7 +148,7 @@ void curl_perform(uv_poll_t *req, int status, int events)
check_multi_info();
}
-void on_timeout(uv_timer_t *req, int status)
+static void on_timeout(uv_timer_t *req, int status)
{
int running_handles;
curl_multi_socket_action(curl_handle, CURL_SOCKET_TIMEOUT, 0,
@@ -158,15 +156,21 @@ void on_timeout(uv_timer_t *req, int status)
check_multi_info();
}
-void start_timeout(CURLM *multi, long timeout_ms, void *userp)
+static int start_timeout(CURLM *multi, long timeout_ms, void *userp)
{
- if(timeout_ms <= 0)
- timeout_ms = 1; /* 0 means directly call socket_action, but we'll do it in
- a bit */
- uv_timer_start(&timeout, on_timeout, timeout_ms, 0);
+ if(timeout_ms < 0) {
+ uv_timer_stop(&timeout);
+ }
+ else {
+ if(timeout_ms == 0)
+ timeout_ms = 1; /* 0 means directly call socket_action, but we'll do it
in
+ a bit */
+ uv_timer_start(&timeout, on_timeout, timeout_ms, 0);
+ }
+ return 0;
}
-int handle_socket(CURL *easy, curl_socket_t s, int action, void *userp,
+static int handle_socket(CURL *easy, curl_socket_t s, int action, void *userp,
void *socketp)
{
curl_context_t *curl_context;
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 160/173: TODO: HTTP Digest using SHA-256, (continued)
- [GNUnet-SVN] [gnurl] 160/173: TODO: HTTP Digest using SHA-256, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 115/173: transfer: only retry nobody-requests for HTTP, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 114/173: telnet: Fix typos, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 130/173: http2: fix memory-leak when denying push streams, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 158/173: urldata: include curl_sspi.h when Windows SSPI is enabled, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 159/173: TODO: brotli is deployed widely now, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 167/173: TODO: "OPTIONS *", gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 134/173: RELEASE-NOTES: synced with 690935390c29c, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 21/173: digest_sspi: copy terminating NUL as well, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 118/173: RELEASE-NOTES: synced with 102454459dd688c, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 142/173: docs: fix timeout handling in multi-uv example,
gnunet <=
- [GNUnet-SVN] [gnurl] 116/173: http2: reset push header counter fixes crash, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 157/173: url: Improve CURLOPT_PROXY_CAPATH error handling, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 121/173: http_proxy: Fix tiny memory leak upon edge case connecting to proxy, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 140/173: http: fix missing 'Content-Length: 0' while negotiating auth, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 87/173: contri*.sh: cut off parentheses from names too, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 143/173: speed caps: update the timeouts if the speed is too low/high, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 91/173: VC: remove the makefile.vc6 build infra, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 156/173: cyassl: fix typo, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 86/173: RELEASE-NOTES: synced with 01ab7c30bba6f, gnunet, 2017/02/24
- [GNUnet-SVN] [gnurl] 102/173: mbedtls: implement CTR-DRBG and HAVEGE random generators, gnunet, 2017/02/24