aboutsummaryrefslogtreecommitdiff
path: root/docs/examples/evhiperfifo.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-02-22 13:44:41 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-02-23 23:08:38 +0100
commit47e540df8f32c8f7298ab1bc96b0087b5738c257 (patch)
tree74c313428b6ab1748ea4f45b6eac2bbf5fbcc71d /docs/examples/evhiperfifo.c
parent42b30ee8f2ed947a288f55ed78c370da10e3dde4 (diff)
examples: remove recursive calls to curl_multi_socket_action
From within the timer callbacks. Recursive is problematic for several reasons. They should still work, but this way the examples and the documentation becomes simpler. I don't think we need to encourage recursive calls. Discussed in #3537 Closes #3601
Diffstat (limited to 'docs/examples/evhiperfifo.c')
-rw-r--r--docs/examples/evhiperfifo.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/docs/examples/evhiperfifo.c b/docs/examples/evhiperfifo.c
index c0c230b26..6474e352c 100644
--- a/docs/examples/evhiperfifo.c
+++ b/docs/examples/evhiperfifo.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2019, 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
@@ -119,13 +119,12 @@ static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g)
{
DPRINT("%s %li\n", __PRETTY_FUNCTION__, timeout_ms);
ev_timer_stop(g->loop, &g->timer_event);
- if(timeout_ms > 0) {
+ if(timeout_ms >= 0) {
+ /* -1 means delete, other values are timeout times in milliseconds */
double t = timeout_ms / 1000;
ev_timer_init(&g->timer_event, timer_cb, t, 0.);
ev_timer_start(g->loop, &g->timer_event);
}
- else if(timeout_ms == 0)
- timer_cb(g->loop, &g->timer_event, 0);
return 0;
}