mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
minor changes
This commit is contained in:
parent
c67f2da283
commit
e66cdacb93
28
lib/multi.c
28
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_multi *multi=(struct Curl_multi *)multi_handle;
|
||||||
struct Curl_one_easy *easy;
|
struct Curl_one_easy *easy;
|
||||||
bool done;
|
bool done;
|
||||||
|
CURLMcode result=CURLM_OK;
|
||||||
|
|
||||||
if(!GOOD_MULTI_HANDLE(multi))
|
if(!GOOD_MULTI_HANDLE(multi))
|
||||||
return CURLM_BAD_HANDLE;
|
return CURLM_BAD_HANDLE;
|
||||||
@ -229,28 +230,30 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
|||||||
|
|
||||||
switch(easy->state) {
|
switch(easy->state) {
|
||||||
case CURLM_STATE_INIT:
|
case CURLM_STATE_INIT:
|
||||||
/* init this transfer. Hm, uh, I can't think of anything to init
|
/* init this transfer. */
|
||||||
right now, let's skip over to CONNECT at once!
|
easy->result=Curl_pretransfer(easy->easy_handle);
|
||||||
|
if(CURLE_OK == easy->result) {
|
||||||
easy->result = Curl_init(easy->easy_handle);
|
/* after init, go CONNECT */
|
||||||
if(CURLE_OK == easy->result)
|
easy->state = CURLM_STATE_CONNECT;
|
||||||
*/
|
result = CURLM_CALL_MULTI_PERFORM;
|
||||||
/* after init, go CONNECT */
|
}
|
||||||
easy->state = CURLM_STATE_CONNECT;
|
|
||||||
break;
|
break;
|
||||||
case CURLM_STATE_CONNECT:
|
case CURLM_STATE_CONNECT:
|
||||||
/* connect */
|
/* connect */
|
||||||
easy->result = Curl_connect(easy->easy_handle);
|
easy->result = Curl_connect(easy->easy_handle);
|
||||||
/* after connect, go DO */
|
/* after connect, go DO */
|
||||||
if(CURLE_OK == easy->result)
|
if(CURLE_OK == easy->result) {
|
||||||
easy->state = CURLM_STATE_DO;
|
easy->state = CURLM_STATE_DO;
|
||||||
|
result = CURLM_CALL_MULTI_PERFORM;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CURLM_STATE_DO:
|
case CURLM_STATE_DO:
|
||||||
/* Do the fetch or put request */
|
/* Do the fetch or put request */
|
||||||
easy->result = Curl_do(easy->easy_handle);
|
easy->result = Curl_do(easy->easy_handle);
|
||||||
/* after do, go PERFORM */
|
/* after do, go PERFORM */
|
||||||
if(CURLE_OK == easy->result)
|
if(CURLE_OK == easy->result) {
|
||||||
easy->state = CURLM_STATE_PERFORM;
|
easy->state = CURLM_STATE_PERFORM;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CURLM_STATE_PERFORM:
|
case CURLM_STATE_PERFORM:
|
||||||
/* read/write data if it is ready to do so */
|
/* 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
|
/* hm, when we follow redirects, we may need to go back to the CONNECT
|
||||||
state */
|
state */
|
||||||
/* after the transfer is done, go DONE */
|
/* 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;
|
easy->state = CURLM_STATE_DONE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CURLM_STATE_DONE:
|
case CURLM_STATE_DONE:
|
||||||
/* post-transfer command */
|
/* post-transfer command */
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
typedef void CURLM;
|
typedef void CURLM;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
CURLM_CALL_MULTI_PERFORM=-1, /* please call curl_multi_perform() soon */
|
||||||
CURLM_OK,
|
CURLM_OK,
|
||||||
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
|
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
|
||||||
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
|
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
|
||||||
|
Loading…
Reference in New Issue
Block a user