curl / Mailing Lists / curl-library / Single Mail

curl-library

Query regarding multiple easy handles on same socket

From: srinivasa srikanth podila via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 18 Jul 2017 21:40:43 +0530

Hi,

I am using libcurl for my applications and is very good. As part of recent
assignment, I need to send multiple HTTP requests over the same socket
asynchronously.

Currently i am using multi handle with CURLMOPT_MAX_TOTAL_CONNECTIONS set
and adding easy_handles[requests] to multi_handle. I am using libuv to
handle the http requests asynchronously. A similar implementation specified
in multi-uv.c example of curl.

*I am doing it on scale of 10000 requests over 1000 connections with a HTTP
Get of 200kb.txt. Upon the socket close[connection reset] by Server, i see
a delayed POLL_REMOVE notification for some sockfds from libcurl and the
libuv is aborting due to BAD_FILE_DESCRIPTOR for those invalidated sockfd
by libcurl. *

Could you please let me know the ideal way of handling these erroneous
scenarios in my application?

I tried using CURLOPT_OPENSOCKETFUNCTION and CURLOPT_CLOSESOCKETFUNCTION to
maintain sockets manually using the multi-handle. However i am getting
close_socket notification for every single request, and i cannot close the
socket as there could be other easy handles using the same socket, So i am
unable to figure out a way to use multiple-requests over the same socket .

I feel if there is a way that libcurl notifies application with POLL_REMOVE
when the sockfd is active, it would be great.

Kindly let me know the way to handle this scenario gracefully.

Thanks,
Srikanth

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-07-18