curl-library
Re: ftp problem
Date: Wed, 17 Jul 2013 23:17:39 +0200 (CEST)
On Wed, 17 Jul 2013, Clemens Gruber wrote:
Thanks for all the details. I'll take you with me on a journey into the inner
workings of some of the libcurl state machines now...
> I added more logging statements, to find out why and where it switches from
> STOP to RETR_TYPE: https://gist.github.com/clemensg/6022039
>
> I am not sure, why the process of setting the TYPE and querying the SIZE is
> repeated. I hope you get a clue on what¢s going on..
Some clues, but still mostly more questions for you to perhaps get even more
logging...
From your recent log line 56:
Connection accepted from server
DEBUG: In ftp_do_more: Calling InitiateTransfer
DEBUG: In ftp_do_more: InitiateTransfer successful
DEBUG: in ftp_do_more: return 0 after ftp->transfer if-else
These are the signs of the server having connected back to us. We should then
be able to do the actual transfer. But I can't fully grasp the following log
lines. In the bottom of the ftp_do_more() function, you can see a block of
code that looks like:
if(!ftpc->wait_data_conn) {
/* no waiting for the data connection so this is now complete */
*complete = TRUE;
DEBUGF(infof(data, "DO-MORE phase ends with %d\n", (int)result));
}
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).
The following log lines:
DEBUG: in ftp_domore_getsock
DEBUG: in ftp_domore_getsock
... is just calls to provide file descriptor information from the ftp
internals. But then:
DEBUG: in ftp_do_more: /*download*/ , calling ftp_range
The is wrong. ftp_do_more() is called again, which would indicate that the
multi handle is still in the CURLM_STATE_DO_MORE state. Why? When the server
had connected back to us we should've left the DO_MORE state to go to DO_DONE
which is a short trancient state that more or less immediately switches to
CURLM_STATE_WAITPERFORM and onwards to CURLM_STATE_PERFORM - the state in
which the actual data transfer is being made in.
So, the questions are:
1 - Does ftp_do_more() set *complete to TRUE when the server connects back?
2 - If it does, why isn't that enough to make the multi code consider that
state complete and move on?
-- / 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-17