cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: ftp problem

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 18 Jul 2013 21:09:41 +0200 (CEST)

On Thu, 18 Jul 2013, Clemens Gruber wrote:

>> That conditional block should run in this case, and *complete would be set
>> to TRUE and that should then trickle back all the way to multi.c:1364 where
>> dophase_done should be made TRUE and then a couple of lines below it should
>> change multi state to CURLM_STATE_DO_DONE (from CURLM_STATE_DO_MORE).
>
> This conditional block is not reached. Therefore complete is not set to
> true. After InitiateTransfer succeeded, ftp_do_more returns before getting
> to the block you mentioned.
>
> Just after:
> ...
> result = ftp_multi_statemach(conn, complete);
> }
> // here I printed the „return .. after ftp->transfer if-else“ log message
> return result;

Ah indeed. What about a quick test to do this:

diff --git a/lib/ftp.c b/lib/ftp.c
index 5d78ad6..e7bd814 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3748,6 +3748,7 @@ static CURLcode ftp_do_more(struct connectdata *conn,
bool

          if(result)
            return result;
+ *complete = TRUE;
        }
      }
      else if(data->set.upload) {

... as that's really what the code intends to do.

> But what happens next, should ftp_do_more be called again and now reach the
> aforementioned conditional block?

After InitiateTransfer() returns fine, ftp_do_more() shouldn't be called
anymore for this transfer.

> And what is the expected behavior if the transfer is completing? Does
> do_more get called over and over again until the server says Transfer
> complete?

No, the (multi state) DO_MORE is just a state while the actual file request is
being made. When the transfer is in progress it is in the PERFORM state and
then it won't be calling do_more at all.

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-07-18