curl / Mailing Lists / curl-users / Single Mail

curl-users

Avoiding sharing connections with multi_handle

From: Corey Kasten <ckasten_at_edgecast.com>
Date: Tue, 24 Jan 2017 12:13:36 -0800

Hi,

I have an application using libcurl (version 7.35.0-1ubuntu2.9) which
continually sends transfers with a multi_handle to different server's, with
one easy_handle for each server destination. In other words I have a bunch
of easy_handles, each of which will always send only to a single server,
with that server being unique with respect to the other easy_handles. While
I am developing this application, I do not have the ability to actually
connect to a bunch of distinct servers, so I am testing by having each
easy_handle transfer to a server at localhost. In order for this simulation
to be most realistic, I wish for each easy_handle to have separate
connections and not share connections amongst them, since, in the real
application, each will be connecting to a different server, and sharing
connections could make things look better in the simulation than they will
be in the real world. However, according to my tcpdump analysis (looking at
'syn' packets), it appears that only one connection is opened every few
seconds, and many more easy_handles added to the multi_handle than the
number of connections initiated. Furthermore, this occurs at program start,
so we can't explain this by saying that each easy_handle is reusing a
connection that it, itself, opened at the beginning, since even the first
transfer on a new easy_handle (added to the multi handle) does not lead to
a connection initiation. Since I have NOT set any options on the
multi_handle via curl_multi_setopt, I had assumed that I should see at
least as many connections initiated as unique easy_handles flowing into the
multi_handle, while that seems not to be the case based on tcpdump output.
Do you have any idea why this is occurring and if it can be prevented?

Thanks
Corey

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-01-24