From d6bb1f1d563dd3748813ad7b6f617ddefc3194dd Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 19 May 2017 14:16:37 +0200 Subject: asiohiper.cpp / evhiperfifo.c: deal with negative timerfunction input That means delete the timer. Reported-by: Michael Kaufmann Ref: #1253 --- docs/examples/asiohiper.cpp | 2 +- docs/examples/evhiperfifo.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/examples/asiohiper.cpp b/docs/examples/asiohiper.cpp index 2ff0e6404..9e0554f59 100644 --- a/docs/examples/asiohiper.cpp +++ b/docs/examples/asiohiper.cpp @@ -90,7 +90,7 @@ static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g) timer.expires_from_now(boost::posix_time::millisec(timeout_ms)); timer.async_wait(boost::bind(&timer_cb, _1, g)); } - else { + else if(timeout_ms == 0) { /* call timeout function immediately */ boost::system::error_code error; /*success*/ timer_cb(error, g); diff --git a/docs/examples/evhiperfifo.c b/docs/examples/evhiperfifo.c index efe42475a..9cb8eae47 100644 --- a/docs/examples/evhiperfifo.c +++ b/docs/examples/evhiperfifo.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -124,7 +124,7 @@ static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g) ev_timer_init(&g->timer_event, timer_cb, t, 0.); ev_timer_start(g->loop, &g->timer_event); } - else + else if(timeout_ms == 0) timer_cb(g->loop, &g->timer_event, 0); return 0; } -- cgit v1.2.3