cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: CURLE_OPERATION_TIMEDOUT using curl_multi_socket_action

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 15 Mar 2013 09:11:25 +0100 (CET)

On Wed, 13 Mar 2013, Paras S wrote:

> Find the sample program attached which illustrates the problem I am facing.
> I am using Mozilla's NSPR: http://www.mozilla.org/projects/nspr/

I don't know nor use NSPR so I can't comment on all subtle details here. But
really, you're using epoll in the example so that is what you should rather
focus more on using correctly here.

Let's try to straighten out everything from the ground up, as this source code
is very VERY far from a proper use of libcurl. It is kind of amazing that it
works to any degree at all!

  1 - your code doesn't use CURLMOPT_TIMERFUNCTION[1] which in the case of
      the socket_action API is just wrong unless you have a very specfic idea
      on how to survive without it and knowledge about why.

  2 - why use a thread pool at all in this case? the multi API handles
      parallell connections in a single thread. You only make things harder for
      yourself by mixing threads into the game like this.

  3 - your socket_callback doesn't _do_ anything??? You are supposed to "catch"
      the socket in there and subscribe to notifications from your event
      library on that sockets (and that specific "action").

  4 - you're using an event-based API so call libcurl when events trigger!

NSPR is not an event library/API, epoll is though.

Perhaps things would be easier if you'd explain more what exactly you want to
accomplish and we can possibly help you get there...

[1] = http://curl.haxx.se/libcurl/c/curl_multi_setopt.html#CURLMOPTTIMERFUNCTION

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-15