cURL / Mailing Lists / curl-library / Single Mail

curl-library

socket callback is not called by curl

From: smruti kumari <smrutikumari777_at_gmail.com>
Date: Tue, 19 Jul 2016 11:46:11 +0530

Hi Daniel,

I am using 7.49.1 version of curl. I have reffer your hiperfifo.c example.
But I am using epoll for event management since it's linux application. I
have followed below steps
1. create the multi handle
2. set callback using CURLMOPT_SOCKETFUNCTION and CURLMOPT_TIMERFUNCTION
3. create the easy handle and added using curl_multi_add_handle()
4. Call curl_multi_socket_action(..., CURL_SOCKET_TIMEOUT, 0, ...)

Once multi timer callback called, I have started the timer. When timer
expire I have called curl_multi_socket_action(..., CURL_SOCKET_TIMEOUT, 0,
...). Now I am observing that the curl is not invoking the socket callback.
I have tried to deug into your code and found below places it's breaking
the loop.

File multi.c:
/* walk over the sockets we got right now */
  for(i=0; (i< MAX_SOCKSPEREASYHANDLE) &&
        (curraction & (GETSOCK_READSOCK(i) | GETSOCK_WRITESOCK(i)));
      i++) {
    int action = CURL_POLL_NONE;

    s = socks[i];

    /* get it from the hash */
    entry = sh_getentry(&multi->sockhash, s);

    if(curraction & GETSOCK_READSOCK(i))
      action |= CURL_POLL_IN;
    if(curraction & GETSOCK_WRITESOCK(i))
      action |= CURL_POLL_OUT;

    if(entry) {
      /* yeps, already present so check if it has the same action set */
      if(entry->action == action)
        /* same, continue */
        continue;
    }
    else {
      /* this is a socket we didn't have before, add it! */
      entry = sh_addentry(&multi->sockhash, s, data);
      if(!entry)
        /* fatal */
        return;
    }

    /* we know (entry != NULL) at this point, see the logic above */
    if(multi->socket_cb)
      multi->socket_cb(data,
                       s,
                       action,
                       multi->socket_userp,
                       entry->socketp);

    entry->action = action; /* store the current action state */
  }
It is not entering to the above loop. So socket callback is not calling by
curl.
Could you please figure out where I went wrong ?

Best regards,
Smruti

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-07-19