diff options
author | Daniel Stenberg <daniel@haxx.se> | 2007-11-15 11:03:02 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2007-11-15 11:03:02 +0000 |
commit | 4e731a0189dd0a76a0619510cf08e2238ce6e02a (patch) | |
tree | 3d233165aa0e15c38f68a6a226332f5567c31c62 /lib | |
parent | 5cf6a539feb3332471de60929edce3e7014521ac (diff) |
Make the Transfer() function return earlier without doing any initializations
for the cases where there's nothing to do in here, like for SFTP directory
listings that already is complete when this function gets called. The init
stuff clears byte counters which isn't really desired.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/transfer.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index 7ccb5769f..64513e003 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -128,7 +128,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp) /* this function returns a size_t, so we typecast to int to prevent warnings with picky compilers */ nread = (int)conn->fread_func(data->reqdata.upload_fromhere, 1, - buffersize, conn->fread_in); + buffersize, conn->fread_in); if(nread == CURL_READFUNC_ABORT) { failf(data, "operation aborted by callback\n"); @@ -1801,15 +1801,6 @@ Transfer(struct connectdata *conn) struct Curl_transfer_keeper *k = &data->reqdata.keep; bool done=FALSE; - if(!(conn->protocol & (PROT_FILE|PROT_TFTP))) { - /* Only do this if we are not transferring FILE or TFTP, since those - transfers are treated differently. They do their entire transfers in - the DO function and just returns from this. That is ugly indeed. - */ - Curl_readwrite_init(conn); - Curl_pre_readwrite(conn); - } - if((conn->sockfd == CURL_SOCKET_BAD) && (conn->writesockfd == CURL_SOCKET_BAD)) /* nothing to read, nothing to write, we're already OK! */ @@ -1819,6 +1810,15 @@ Transfer(struct connectdata *conn) if(!conn->bits.getheader && conn->bits.no_body) return CURLE_OK; + if(!(conn->protocol & (PROT_FILE|PROT_TFTP))) { + /* Only do this if we are not transferring FILE or TFTP, since those + transfers are treated differently. They do their entire transfers in + the DO function and just returns from this. That is ugly indeed. + */ + Curl_readwrite_init(conn); + Curl_pre_readwrite(conn); + } + while(!done) { curl_socket_t fd_read; curl_socket_t fd_write; |