Sortix cross-volatile manual
This manual documents Sortix cross-volatile. You can instead view this document in the latest official manual.
curl_easy_pause(3) | Library Functions Manual | curl_easy_pause(3) |
NAME
curl_easy_pause - pause and unpause a connectionDESCRIPTION
Using this function, you can explicitly mark a running connection to get paused, and you can unpause a connection that was previously paused. Unlike most other libcurl functions, curl_easy_pause(3) can be used from within callbacks.- CURLPAUSE_RECV
- Pause receiving data. There is no data received on this connection until this function is called again without this bit set. Thus, the write callback ( CURLOPT_WRITEFUNCTION(3)) is not called.
- CURLPAUSE_SEND
- Pause sending data. There is no data sent on this connection until this function is called again without this bit set. Thus, the read callback ( CURLOPT_READFUNCTION(3)) is not called.
- CURLPAUSE_ALL
- Convenience define that pauses both directions.
- CURLPAUSE_CONT
- Convenience define that unpauses both directions.
LIMITATIONS
The pausing of transfers does not work with protocols that work without network connectivity, like FILE://. Trying to pause such a transfer, in any direction, might cause problems or error.MULTIPLEXED
When a connection is used multiplexed, like for HTTP/2, and one of the transfers over the connection is paused and the others continue flowing, libcurl might end up buffering contents for the paused transfer. It has to do this because it needs to drain the socket for the other transfers and the already announced window size for the paused transfer allows the server to continue sending data up to that window size amount. By default, libcurl announces a 32 megabyte window size, which thus can make libcurl end up buffering 32 megabyte of data for a paused stream.PROTOCOLS
This functionality affects all supported protocolsEXAMPLE
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
/* pause a transfer in both directions */
curl_easy_pause(curl, CURLPAUSE_RECV | CURLPAUSE_SEND);
}
}
MEMORY USE
When pausing a download transfer by returning the magic return code from a write callback, the read data is already in libcurl's internal buffers so it has to keep it in an allocated buffer until the receiving is again unpaused using this function.AVAILABILITY
Added in curl 7.18.0RETURN VALUE
CURLE_OK (zero) means that the option was set properly, and a non-zero return code means something wrong occurred after the new state was set. See the libcurl-errors(3) man page for the full list with descriptions.SEE ALSO
curl_easy_cleanup(3), curl_easy_reset(3)2024-11-23 | libcurl |