summaryrefslogtreecommitdiff
path: root/lib/easy.c
diff options
context:
space:
mode:
authorHoward Chu <hyc@highlandsun.com>2010-05-07 15:05:34 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-05-07 15:05:34 +0200
commitd64bd82bdcb169d0647a80f00068cedd761f8163 (patch)
tree222920db94e7d4ae7df6df1f9a9afd0b78159492 /lib/easy.c
parentcb6647ce1cfba836203e91057752441302b9c46a (diff)
downloadcurl-d64bd82bdcb169d0647a80f00068cedd761f8163.tar.gz
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.
Diffstat (limited to 'lib/easy.c')
-rw-r--r--lib/easy.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/easy.c b/lib/easy.c
index 53f417fc3..637d99bb0 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -1108,7 +1108,6 @@ CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n)
{
curl_socket_t sfd;
CURLcode ret;
- int ret1;
ssize_t n1;
struct connectdata *c;
struct SessionHandle *data = (struct SessionHandle *)curl;
@@ -1118,13 +1117,10 @@ CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n)
return ret;
*n = 0;
- ret1 = Curl_read(c, sfd, buffer, buflen, &n1);
+ ret = Curl_read(c, sfd, buffer, buflen, &n1);
- if(ret1 == -1)
- return CURLE_AGAIN;
-
- if(ret1 != CURLE_OK)
- return (CURLcode)ret1;
+ if(ret != CURLE_OK)
+ return ret;
*n = (size_t)n1;