cURL / Mailing Lists / curl-library / Single Mail

curl-library

resuming a paused multi session

From: Steve Roskowski <rosko_at_thirdiris.com>
Date: Wed, 29 Dec 2010 13:12:20 -0800

I am having trouble figuring out the approved way to resume a paused
multi socket send session.

I am using a poll based single threaded implementation with
multi_socket at the core.

I have a read_callback function which supplies data, and use
socket_callback to add the socket to my poll loop.

When the read_callback can't keep up, I pause the session (returning
READ_FUNC_PAUSE). This shortly results in a callback to remove the OUT
poll from the poll loop.

When data is available, I do a curl_easy_pause(handle,
CURLPAUSE_CONT). This correctly changes the session keepon state back
to running, but does not cause a new socket_callback to add the
sending fd back into the poll loop.

At this point, I do not know what to do. A solution that works is to
do a curl_multi_socket_all(), which forces a handle rescan and the
resulting socket_callback, but it is deprecated. I do not link
handles to sockets (the poll loop works only on sockets, the curl
logic only on handles), and I don't know an easy way of making the
relationship anyway... so I cannot use curl_multi_socket_action
without the socket.

Am I missing something? if not, adding a conditional to the
curl_multi_socket_action call which detects a -1 socket and calls
multi_socket with the checkall flag (essentially undeprecating
multi_socket_all for this use case) seems a pretty elegant way of
solving the issue... and adding some documentation to the
curl_easy_pause page about the necessity of calling it in a
multi-socket world. Alternatively, is there an easy way to get the
socket out of the handle (int sock =-1; curl_easy_getinfo(handle,
CURLINFO_LASTSOCKET, &sock) leaves sock at -1) as it allow me to use
socket_action with the specific socket.

thanks
steve
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-12-29