mirror of
https://github.com/curl/curl.git
synced 2026-07-30 22:28:02 +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
|
|
@ -466,15 +466,18 @@ static CURLcode readwrite_data(struct Curl_easy *data,
|
|||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
CURLcode result = CURLE_OK;
|
||||
char *buf;
|
||||
size_t blen;
|
||||
char *buf, *xfer_buf;
|
||||
size_t blen, xfer_blen;
|
||||
int maxloops = 10;
|
||||
curl_off_t total_received = 0;
|
||||
bool is_multiplex = FALSE;
|
||||
|
||||
DEBUGASSERT(data->state.buffer);
|
||||
*done = FALSE;
|
||||
|
||||
result = Curl_multi_xfer_buf_borrow(data, &xfer_buf, &xfer_blen);
|
||||
if(result)
|
||||
goto out;
|
||||
|
||||
/* This is where we loop until we have read everything there is to
|
||||
read or we get a CURLE_AGAIN */
|
||||
do {
|
||||
|
|
@ -489,8 +492,8 @@ static CURLcode readwrite_data(struct Curl_easy *data,
|
|||
is_multiplex = Curl_conn_is_multiplex(conn, FIRSTSOCKET);
|
||||
}
|
||||
|
||||
buf = data->state.buffer;
|
||||
bytestoread = data->set.buffer_size;
|
||||
buf = xfer_buf;
|
||||
bytestoread = xfer_blen;
|
||||
|
||||
/* Observe any imposed speed limit */
|
||||
if(bytestoread && data->set.max_recv_speed) {
|
||||
|
|
@ -564,6 +567,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
|
|||
}
|
||||
|
||||
out:
|
||||
Curl_multi_xfer_buf_release(data, xfer_buf);
|
||||
if(result)
|
||||
DEBUGF(infof(data, "readwrite_data() -> %d", result));
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue