1curl_easy_pause(3)              libcurl Manual              curl_easy_pause(3)
2
3
4

NAME

6       curl_easy_pause - pause and unpause a connection
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_pause(CURL *handle, int bitmask);
12

DESCRIPTION

14       Using  this  function,  you can explicitly mark a running connection to
15       get paused, and you  can  unpause  a  connection  that  was  previously
16       paused.
17
18       A  connection  can  be  paused by using this function or by letting the
19       read or the  write  callbacks  return  the  proper  magic  return  code
20       (CURL_READFUNC_PAUSE  and  CURL_WRITEFUNC_PAUSE). A write callback that
21       returns pause signals to the library that it could not take care of any
22       data at all, and that data will then be delivered again to the callback
23       when the transfer is unpaused.
24
25       While it may feel tempting, take care and notice that you  cannot  call
26       this function from another thread. To unpause, you may for example call
27       it from the progress callback (CURLOPT_PROGRESSFUNCTION(3)), which gets
28       called at least once per second, even if the connection is paused.
29
30       When  this  function is called to unpause receiving, the chance is high
31       that you will get your write callback called before this  function  re‐
32       turns.
33
34       The  handle  argument  identifies the transfer you want to pause or un‐
35       pause.
36
37       A paused transfer is excluded from  low  speed  cancels  via  the  CUR‐
38       LOPT_LOW_SPEED_LIMIT(3)  option and unpausing a transfer will reset the
39       time period required for the low speed limit to be met.
40
41       The bitmask argument is a set of bits that sets the new  state  of  the
42       connection. The following bits can be used:
43
44       CURLPAUSE_RECV
45              Pause  receiving  data.  There  will be no data received on this
46              connection until this function is called again without this  bit
47              set.  Thus,  the  write callback (CURLOPT_WRITEFUNCTION(3)) will
48              not be called.
49
50       CURLPAUSE_SEND
51              Pause sending data. There will be no data sent on  this  connec‐
52              tion  until  this function is called again without this bit set.
53              Thus, the read callback (CURLOPT_READFUNCTION(3))  will  not  be
54              called.
55
56       CURLPAUSE_ALL
57              Convenience define that pauses both directions.
58
59       CURLPAUSE_CONT
60              Convenience define that unpauses both directions.
61

LIMITATIONS

63       The pausing of transfers does not work with protocols that work without
64       network connectivity, like FILE://. Trying to pause such a transfer, in
65       any direction, will cause problems in the worst case or an error in the
66       best case.
67

MULTIPLEXED

69       When a connection is used multiplexed, like for HTTP/2, and one of  the
70       transfers  over  the connection is paused and the others continue flow‐
71       ing, libcurl might end up buffering contents for the  paused  transfer.
72       It  has  to  do this because it needs to drain the socket for the other
73       transfers and the already announced window size for the paused transfer
74       will  allow  the server to continue sending data up to that window size
75       amount. By default, libcurl announces a 32 megabyte window size,  which
76       thus can make libcurl end up buffering 32 megabyte of data for a paused
77       stream.
78
79       When such a paused stream is unpaused again, any buffered data will  be
80       delivered first.
81

EXAMPLE

83       /* pause a transfer in both directions */
84       curl_easy_pause(curl, CURL_READFUNC_PAUSE | CURL_WRITEFUNC_PAUSE);
85

MEMORY USE

87       When  pausing  a  read  by returning the magic return code from a write
88       callback, the read data is already in libcurl's internal buffers so  it
89       will  have  to  keep  it  in an allocated buffer until the receiving is
90       again unpaused using this function.
91
92       If the downloaded data is compressed and is asked to  get  uncompressed
93       automatically  on download, libcurl will continue to uncompress the en‐
94       tire downloaded chunk and it will cache the data uncompressed. This has
95       the  side-  effect  that if you download something that is compressed a
96       lot, it can result in a large data amount needing to  be  allocated  to
97       save the data during the pause. This said, you should probably consider
98       not using paused receiving if you allow libcurl to uncompress data  au‐
99       tomatically.
100

AVAILABILITY

102       Added in 7.18.0.
103

RETURN VALUE

105       CURLE_OK  (zero) means that the option was set properly, and a non-zero
106       return code means something wrong occurred after the new state was set.
107       See the libcurl-errors(3) man page for the full list with descriptions.
108

SEE ALSO

110       curl_easy_cleanup(3), curl_easy_reset(3)
111
112
113
114libcurl 7.82.0                 November 26, 2021            curl_easy_pause(3)
Impressum