cURL / Mailing Lists / curl-library / Single Mail

curl-library

Disabling FTP inactivity timeouts

From: John Coffey <johnco3_at_gmail.com>
Date: Fri, 5 Dec 2014 14:06:04 -0500

Hello,

I have an FTP application that behaves differently on windows (as an ftp
client) vs its linux embedded counterpart (what a surprise). The basic
problem is that a remote server that my client connects to performs a very
long operation just before it returns the 226 response - actually it is a
device that is performing flash reclamation under the covers. This time
can take up to 900 seconds. In effect I am performing a data inactivity
timeout while awaiting the remote 226 or error response to get returned.

On windows this works fine, however on our linux powerpc embedded client
(where we use the latest libCurl-7.39.0) the client times out after exactly
60 seconds of ftp inactivity. The way I set the timers is as follows:
(note that I am using ensuring that the CURLOPT_FTP_RESPONSE_TIMEOUT has a
1 second lower value than CURLOPT_TIMEOUT. In addition it is worth noting
that the CURLOPT_CONNECTTIMEOUT is set to 60 seconds (perhaps this is
coincidence, but it takes CURLOPT_CONNECTTIMEOUT seconds for the inactivity
to timeout on the linux client). I wonder if there is some bug in that the
CURLOPT_CONNECTTIMEOUT is overwriting the CURLOPT_FTP_RESPONSE_TIMEOUT on
the linux client?

Other than that my curl options are working fine.

Any ideas?

All the best

                        // if updating the module could potentially
                        // cause flash reclamation, set the command to
response FTP
                        // timer to include both delivery time + the max
expected
                        // time for the file put for the biggest file over
BASE2 or BASET
                        auto flashReclTimeout =
rContext.getFlashReclTimeout();
                        if (flashReclTimeout) {
                            auto timeoutSecs =
duration_cast<seconds>(flashReclTimeout.get());
                            auto res =
curl_easy_setopt(rContext.getCurlHandle(),
                                CURLOPT_TIMEOUT, timeoutSecs.count()+1);
                            res = curl_easy_setopt(rContext.getCurlHandle(),
                                CURLOPT_FTP_RESPONSE_TIMEOUT,
timeoutSecs.count());
                            ss << ", [flash reclamation timeout "
                                << timeoutSecs.count()
                                << "(s)]";
                        }
                        LOG_EVT_INFO(gEvtLog) << rLogPrefix << ss.str() <<
std::endl;

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-12-05