aboutsummaryrefslogtreecommitdiff
path: root/lib/multi.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-12-20 12:52:24 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-12-20 20:30:02 +0100
commitdfdac61522c7d660f884ec7a663dedb2d69d16a8 (patch)
tree18fb71b132893a5bc84324002830bddb56b70309 /lib/multi.c
parentc834213ad52c52431e9ca597862dc81839cabe84 (diff)
non-blocking active FTP: cleanup multi state usage
Backpedaled out the funny double-change of state in the multi state machine by adding a new argument to the do_more() function to signal completion. This way it can remain in the DO_MORE state properly until done. Long term, the entire DO_MORE logic should be moved into the FTP code and be hidden from the multi code as the logic is only used for FTP.
Diffstat (limited to 'lib/multi.c')
-rw-r--r--lib/multi.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/lib/multi.c b/lib/multi.c
index e408ab184..6ec20ec80 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1361,40 +1361,31 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
break;
case CURLM_STATE_DO_MORE:
- /* Ready to do more? */
- easy->result = Curl_is_connected(easy->easy_conn,
- SECONDARYSOCKET,
- &connected);
- if(connected) {
- /*
- * When we are connected, DO MORE and then go DO_DONE
- */
- easy->result = Curl_do_more(easy->easy_conn);
-
- /* No need to remove ourselves from the send pipeline here since that
- is done for us in Curl_done() */
+ /*
+ * When we are connected, DO MORE and then go DO_DONE
+ */
+ easy->result = Curl_do_more(easy->easy_conn, &dophase_done);
- if(CURLE_OK == easy->result) {
+ /* No need to remove this handle from the send pipeline here since that
+ is done in Curl_done() */
+ if(CURLE_OK == easy->result) {
+ if(dophase_done) {
multistate(easy, CURLM_STATE_DO_DONE);
result = CURLM_CALL_MULTI_PERFORM;
}
- else {
- /* failure detected */
- Curl_posttransfer(data);
- Curl_done(&easy->easy_conn, easy->result, FALSE);
- disconnect_conn = TRUE;
- }
+ else
+ /* stay in DO_MORE */
+ result = CURLM_OK;
+ }
+ else {
+ /* failure detected */
+ Curl_posttransfer(data);
+ Curl_done(&easy->easy_conn, easy->result, FALSE);
+ disconnect_conn = TRUE;
}
break;
case CURLM_STATE_DO_DONE:
-
- if(easy->easy_conn->bits.wait_data_conn == TRUE) {
- multistate(easy, CURLM_STATE_DO_MORE);
- result = CURLM_OK;
- break;
- }
-
/* Move ourselves from the send to recv pipeline */
moveHandleFromSendToRecvPipeline(data, easy->easy_conn);
/* Check if we can move pending requests to send pipe */