From dfdac61522c7d660f884ec7a663dedb2d69d16a8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 20 Dec 2011 12:52:24 +0100 Subject: 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. --- lib/url.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'lib/url.c') diff --git a/lib/url.c b/lib/url.c index b952e920a..9896dd8c0 100644 --- a/lib/url.c +++ b/lib/url.c @@ -5457,14 +5457,25 @@ CURLcode Curl_do(struct connectdata **connp, bool *done) return result; } -CURLcode Curl_do_more(struct connectdata *conn) +/* + * Curl_do_more() is called during the DO_MORE multi state. It is basically a + * second stage DO state which (wrongly) was introduced to support FTP's + * second connection. + * + * TODO: A future libcurl should be able to work away this state. + * + */ + +CURLcode Curl_do_more(struct connectdata *conn, bool *completed) { CURLcode result=CURLE_OK; + *completed = FALSE; + if(conn->handler->do_more) - result = conn->handler->do_more(conn); + result = conn->handler->do_more(conn, completed); - if(result == CURLE_OK && conn->bits.wait_data_conn == FALSE) + if(!result && completed) /* do_complete must be called after the protocol-specific DO function */ do_complete(conn); -- cgit v1.2.3