New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example programs for CURLMOPT_TIMERFUNCTION don't handle timeout_ms == -1 correctly #1253

Closed
mkauf opened this Issue Feb 7, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@mkauf
Contributor

mkauf commented Feb 7, 2017

I did this

Studied the code of the example programs for CURLMOPT_TIMERFUNCTION:

These example programs don't handle timeout_ms == -1 correctly.

I expected the following

The documentation for CURLMOPT_TIMERFUNCTION says:

A timeout_ms value of -1 means you should delete your timer.

These example programs call curl_multi_socket_action() instead:

  • asiohiper.cpp
  • evhiperfifo.c
  • multi-uv.c

These exampe programs schedule a new timer instead:

  • ghiper.c
  • hiperfifo.c

Note that the timeout value 0 also has a special meaning:

A timeout_ms value of 0 means you should call curl_multi_socket_action or curl_multi_perform (once) as soon as possible.

curl/libcurl version

7.52.1

operating system

All

@bagder

This comment has been minimized.

Member

bagder commented Feb 7, 2017

The good thing is that just having an extra timer running or calling curl_multi_socket_action() an extra time are all pretty harmless actions.

@bagder bagder added the documentation label Feb 8, 2017

@bagder

This comment has been minimized.

Member

bagder commented May 19, 2017

multi-uv.c seems to handle it already.

I've fixed asiohiper.cpp and evhiperfifo.c in commit d6bb1f1

bagder added a commit that referenced this issue May 19, 2017

asiohiper.cpp / evhiperfifo.c: deal with negative timerfunction input
That means delete the timer.

Reported-by: Michael Kaufmann
Ref: #1253

@bagder bagder closed this in e5491e0 May 19, 2017

@mkauf

This comment has been minimized.

Contributor

mkauf commented May 20, 2017

Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.