The OPTIMIZE CONNECTION feature: very easy and very usefull

Archived discussion about features (predating the use of Bugzilla as a bug and feature tracker)

Moderator: Moderators

Sheevar
Posts: 2
Joined: 2003-03-02 14:38

The OPTIMIZE CONNECTION feature: very easy and very usefull

Post by Sheevar » 2003-03-03 13:28

Again I'm insisting on how could be usefull the following feature:
if the download speed of a file is under a certain value, dc automatically
disconnect from that user (so if I have a list of alternate users it will
automatically try with another one).

If after a certain number of tries no connection is possible, then that value decrements (so that after or before I'll download from someone).

After a given amout of time the value could raise again so that dc
tries again to find some faster user.

THIS WOULD BE VERY HELPFUL BECAUSE:
- download are optimezed->net is less crowded -> files are retrieved faster
- who can download fast downloads fast, who can download slow still
downloads slow

This is very very easy to achieve, I would have done it by myself (I'm a c++ programmer) but currently I cannot setup the development environment on my pc. However I looked at the code:

method:

Code: Select all

DownloadManager::checkDownloads(UserConnection* aConn)


(since the max upload limit is quite unusefull for me I propose to use
that parameter for the Min upload limit)
the modification to do is:
OLD CODE:

Code: Select all

if( ((SETTING(DOWNLOAD_SLOTS) != 0) && getDownloads() >= SETTING(DOWNLOAD_SLOTS)) ||
      ((SETTING(MAX_DOWNLOAD_SPEED) != 0 && getAverageSpeed() >= (SETTING(MAX_DOWNLOAD_SPEED)*1024)) ) ) {
      
      if(!QueueManager::getInstance()->hasDownload(aConn->getUser(), QueueItem::HIGHEST)) {
         removeConnection(aConn);
         return;
      }
   }


NEW CODE:
add variables:

Code: Select all

int numberOfTrials = 10; (or configurable)
currentTrial = 0;


if (currentTrial == numberOfTrials)
{
       currentTrial = 0;
       decreaseMinDownladSpeed(): (method that will decrease the MIN_DOWNLOAD_SPEED value)
}


if( ((SETTING(DOWNLOAD_SLOTS) != 0) && getDownloads() >= SETTING(DOWNLOAD_SLOTS)) ||
      (((SETTING(MIN_DOWNLOAD_SPEED)!= 0 && getAverageSpeed() < (((SETTING(MIN_DOWNLOAD_SPEED)*1024)) ) ) {
      
      if(!QueueManager::getInstance()->hasDownload(aConn->getUser(), QueueItem::HIGHEST)) {
         removeConnection(aConn);
                                                currentTrial++;
         return;
      }
   }

and then a method shall be added so that every x minutes the
MIN_DOWNLOAD_SPEED is raised again to the original value.

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-08 02:46
Location: .pa.us

Re: The OPTIMIZE CONNECTION feature: very easy and very usef

Post by GargoyleMT » 2003-03-03 17:12

Hint: [code] is your friend. :)

Does each source have a structure that you can use for a timeout? If not, you need to extend it. (I'm on lunch, don't have the source handy.)

All of the code in client/ should be able to compile on linux without incident, even if you don't have Visual C++/Studio, you can still do development on at least parts of the client. Testing them is an excersize for the the reader, however. :wink:

Once you do so, just send the patch to Arne and he'll at least get back to you, if it doesn't become a feature in the next version.

Who is online

Users browsing this forum: Google [Bot] and 0 guests