cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Multiple Easy Interface FTP Threads not calling write function callback when more than 2 active

From: Kable Dan (CDI) <Dan.Kable_at_technicolor.com>
Date: Mon, 20 Jun 2011 11:00:40 -0400

From: Kable Dan (CDI)
Sent: Monday, June 20, 2011 10:34 AM
To: 'curl-library_at_cool.haxx.se'
Subject: Multiple Easy Interface FTP Threads not calling write function callback when more than 2 active

I686 Linux system

Tested versions: libcurl/7.21.6 and libcurl/7.21.2

I am creating up to 4 concurrent threads of Easy Interface calls each of which are setup within their own thread as:

  myTracker->curl = curl_easy_init();
  if(myTracker->curl)
  {
    curl_easy_setopt(myTracker->curl, CURLOPT_URL,(void *)myTracker->inUri.c_str());
    curl_easy_setopt(myTracker->curl, CURLOPT_RESUME_FROM_LARGE, (curl_off_t)myTracker->currentSize);
    curl_easy_setopt(myTracker->curl, CURLOPT_WRITEFUNCTION, &writeMemoryCallback);
    curl_easy_setopt(myTracker->curl, CURLOPT_WRITEDATA, (void *)myTracker);
    curl_easy_setopt(myTracker->curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");   
    curl_easy_setopt(myTracker->curl, CURLOPT_NOBODY,0L);
    curl_easy_setopt(myTracker->curl, CURLOPT_HEADER,0L);
    curl_easy_setopt(myTracker->curl, CURLOPT_FOLLOWLOCATION,1L);  
    curl_easy_setopt(myTracker->curl, CURLOPT_CONNECTTIMEOUT, 10L);
    if( myTracker->currentBandwidth )
    {
     curl_easy_setopt(myTracker->curl, CURLOPT_MAX_RECV_SPEED_LARGE, myTracker->currentBandwidth);
     curl_easy_setopt(myTracker->curl, CURLOPT_MAX_SEND_SPEED_LARGE, myTracker->currentBandwidth);
    }
    curl_easy_setopt(myTracker->curl, CURLOPT_ERRORBUFFER, curlErrorInfo);
    curl_easy_setopt(myTracker->curl, CURLOPT_NOPROGRESS, 1L);
    myTracker->copyStartTime = time(NULL);
    myTracker->lastCopyTime = myTracker->copyStartTime;
    res = curl_easy_perform(myTracker->curl);
}

The thread that creates up to 4 of the above Easy Interface threads has the
curl_global_init(CURL_GLOBAL_ALL);
before any of the Easy Interface Threads are called.

I am only downloading, using protocols FTP, HTTP, TFTP, and FILE.  I am using IIS under windows 7 as the test HTTP and FTP server.  All concurrent requests go to this server for different files.  When I use http as the protocol, my callback function, writeMemoryCallback is being called for every thread up to the max 4 all the time.  When I use ftp as the protocol, only the first two threads use the writeMemoryCallback function during the transfer.  The other two ftp threads are downloading the file but never call the callback function until the file has been totally transferred.  This makes it impossible to report status on any ftp download > 2.

Dan Kable

dan.kable_at_technicolor.com
work: (317) 587 4162

101 W. 103rd St.
Indianapolis, IN 46290

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-06-20