mirror of
https://github.com/curl/curl.git
synced 2026-08-02 08:00:29 +03:00
sendrecv: split the I/O handling into private handler
Howard Chu brought the bulk work of this patch that properly moves out the sending and recving of data to the parts of the code that are properly responsible for the various ways of doing so. Daniel Stenberg assisted with polishing a few bits and fixed some minor flaws in the original patch. Another upside of this patch is that we now abuse CURLcodes less with the "magic" -1 return codes and instead use CURLE_AGAIN more consistently.
This commit is contained in:
parent
cb6647ce1c
commit
d64bd82bdc
26 changed files with 297 additions and 433 deletions
|
|
@ -1283,7 +1283,6 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||
struct SessionHandle *data=conn->data;
|
||||
struct SingleRequest *k = &data->req;
|
||||
CURLcode result;
|
||||
int res;
|
||||
long timeout =
|
||||
data->set.timeout?data->set.timeout:PROXY_TIMEOUT; /* in milliseconds */
|
||||
curl_socket_t tunnelsocket = conn->sock[sockindex];
|
||||
|
|
@ -1467,11 +1466,10 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||
break;
|
||||
default:
|
||||
DEBUGASSERT(ptr+BUFSIZE-nread <= data->state.buffer+BUFSIZE+1);
|
||||
res = Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread, &gotbytes);
|
||||
if(res< 0)
|
||||
/* EWOULDBLOCK */
|
||||
result = Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread, &gotbytes);
|
||||
if(result==CURLE_AGAIN)
|
||||
continue; /* go loop yourself */
|
||||
else if(res)
|
||||
else if(result)
|
||||
keepon = FALSE;
|
||||
else if(gotbytes <= 0) {
|
||||
keepon = FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue