curl-library
Re: Asynchronous ordered sends
Date: Thu, 23 Mar 2017 08:09:58 -0400
Daniel Stenberg wrote:
> On Tue, 21 Mar 2017, Emir Kamber wrote:
>
>> I have successfully implemented async sends via 'multi-functionality',
>> but I have a problem where messages are sent in no particular order. So,
>> when I send 3 messages, I get this on the wire: MSG3, MSG1, MSG2.
>>
>> I need to send messages in the order that I add them via
>> 'curl_multi_add_handle', so that I get MSG1, MSG2, MSG3 on the wire. In
>> essence I just need to send an X number of messages in sequence as
>> quickly as possible, and then will worry about reading the response from
>> the server.
>
> The multi API handles many transfers in parallel, but it will do them all
> independent and as fast as possible. If you add three easy handles, libcurl
> will try to perform those three transfers as quickly as it can.
>
> If you need the transfers done serially, you need to wait until transfer one
> is done before you add the easy handle for transfer two and so on.
>
If one wants to have messages transmit in order, but with overlap, like
MSG111111111111
MSG22222222222222
MSG333333333333333
I wonder if a suitable callback from msg1 transfer could be used to fire off
msg2 once msg1 is underway (first read callback?) A callback from msg2 could
launch msg3 once msg2 is going...
Is it safe to add a new easy handle to a multi handle in a read or write
callback or would some other technique have to be used? Connection re-use
could complicate things...
Rich
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-03-23