mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:21:41 +03:00
multi: add xfer_buf to multi handle
- can be borrowed by transfer during recv-write operation - needs to be released before borrowing again - adjustis size to `data->set.buffer_size` - used in transfer.c readwrite_data() Closes #12805
This commit is contained in:
parent
c54d0ff6b3
commit
476adfeac0
10 changed files with 113 additions and 25 deletions
|
|
@ -94,4 +94,28 @@ CURLMcode Curl_multi_add_perform(struct Curl_multi *multi,
|
|||
/* Return the value of the CURLMOPT_MAX_CONCURRENT_STREAMS option */
|
||||
unsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi);
|
||||
|
||||
/**
|
||||
* Borrow the transfer buffer from the multi, suitable
|
||||
* for the given transfer `data`. The buffer may only be used in one
|
||||
* multi processing of the easy handle. It MUST be returned to the
|
||||
* multi before it can be borrowed again.
|
||||
* Pointers into the buffer remain only valid as long as it is borrowed.
|
||||
*
|
||||
* @param data the easy handle
|
||||
* @param pbuf on return, the buffer to use or NULL on error
|
||||
* @param pbuflen on return, the size of *pbuf or 0 on error
|
||||
* @return CURLE_OK when buffer is available and is returned.
|
||||
* CURLE_OUT_OF_MEMORy on failure to allocate the buffer,
|
||||
* CURLE_FAILED_INIT if the easy handle is without multi.
|
||||
* CURLE_AGAIN if the buffer is borrowed already.
|
||||
*/
|
||||
CURLcode Curl_multi_xfer_buf_borrow(struct Curl_easy *data,
|
||||
char **pbuf, size_t *pbuflen);
|
||||
/**
|
||||
* Release the borrowed buffer. All references into the buffer become
|
||||
* invalid after this.
|
||||
* @param buf the buffer pointer borrowed for coding error checks.
|
||||
*/
|
||||
void Curl_multi_xfer_buf_release(struct Curl_easy *data, char *buf);
|
||||
|
||||
#endif /* HEADER_CURL_MULTIIF_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue