summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-12-13 07:16:27 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-12-13 07:16:27 +0000
commite66cdacb936976003a4c7a07515c24fe7af918b5 (patch)
tree457186c6b5a75657021844898679adc115b2f2ec /lib
parentc67f2da283c8cb8dc3cd7c783c73ef0ff8726215 (diff)
downloadcurl-e66cdacb936976003a4c7a07515c24fe7af918b5.tar.gz
minor changes
Diffstat (limited to 'lib')
-rw-r--r--lib/multi.c28
-rw-r--r--lib/multi.h1
2 files changed, 18 insertions, 11 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 57969d4ee..ff9e91fea 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -220,6 +220,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
struct Curl_one_easy *easy;
bool done;
+ CURLMcode result=CURLM_OK;
if(!GOOD_MULTI_HANDLE(multi))
return CURLM_BAD_HANDLE;
@@ -229,28 +230,30 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
switch(easy->state) {
case CURLM_STATE_INIT:
- /* init this transfer. Hm, uh, I can't think of anything to init
- right now, let's skip over to CONNECT at once!
-
- easy->result = Curl_init(easy->easy_handle);
- if(CURLE_OK == easy->result)
- */
- /* after init, go CONNECT */
- easy->state = CURLM_STATE_CONNECT;
+ /* init this transfer. */
+ easy->result=Curl_pretransfer(easy->easy_handle);
+ if(CURLE_OK == easy->result) {
+ /* after init, go CONNECT */
+ easy->state = CURLM_STATE_CONNECT;
+ result = CURLM_CALL_MULTI_PERFORM;
+ }
break;
case CURLM_STATE_CONNECT:
/* connect */
easy->result = Curl_connect(easy->easy_handle);
/* after connect, go DO */
- if(CURLE_OK == easy->result)
+ if(CURLE_OK == easy->result) {
easy->state = CURLM_STATE_DO;
+ result = CURLM_CALL_MULTI_PERFORM;
+ }
break;
case CURLM_STATE_DO:
/* Do the fetch or put request */
easy->result = Curl_do(easy->easy_handle);
/* after do, go PERFORM */
- if(CURLE_OK == easy->result)
+ if(CURLE_OK == easy->result) {
easy->state = CURLM_STATE_PERFORM;
+ }
break;
case CURLM_STATE_PERFORM:
/* read/write data if it is ready to do so */
@@ -258,8 +261,11 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
/* hm, when we follow redirects, we may need to go back to the CONNECT
state */
/* after the transfer is done, go DONE */
- if(TRUE == done)
+ if(TRUE == done) {
+ /* call this even if the readwrite function returned error */
+ easy->result = Curl_posttransfer(easy->easy_handle);
easy->state = CURLM_STATE_DONE;
+ }
break;
case CURLM_STATE_DONE:
/* post-transfer command */
diff --git a/lib/multi.h b/lib/multi.h
index 3fe2bdf6a..1fdce73f0 100644
--- a/lib/multi.h
+++ b/lib/multi.h
@@ -55,6 +55,7 @@
typedef void CURLM;
typedef enum {
+ CURLM_CALL_MULTI_PERFORM=-1, /* please call curl_multi_perform() soon */
CURLM_OK,
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */