small changes

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1434 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
alexandrut 2009-07-26 19:00:16 +00:00
parent 6f69a9edf3
commit e69351dda9

View file

@ -29,7 +29,7 @@ void ftDwlQueue::run()
while (1) { while (1) {
#ifdef WIN_32 #ifdef WIN32
Sleep(1000); Sleep(1000);
#else #else
sleep(1); sleep(1);
@ -37,16 +37,20 @@ void ftDwlQueue::run()
unsigned int sDwl = totalSystemDwl(); unsigned int sDwl = totalSystemDwl();
unsigned int qDwl = totalQueuedDwl(); unsigned int qDwl = totalQueuedDwl();
unsigned int dwl = 0;
/* we have to know if one ore more downloads are if (sDwl - qDwl >= 0) {
* paused in the queue and the next of them will dwl = sDwl - qDwl; /* real downloads, not in the queue */
* not exceed download limit*/ }
if (!(qDwl && (sDwl - 1 < downloadLimit))) continue;
/* we have to know if the next download from
* queue will exceed the download limit */
if (dwl + 1 > downloadLimit) continue;
DwlDetails details; DwlDetails details;
if (!getNext(details)) continue; if (!getNext(details)) continue;
/* if the download was puased restart it /* if the download was paused restart it
* else try a new request for download it */ * else try a new request for download it */
if (details.paused == true) { if (details.paused == true) {
@ -115,7 +119,7 @@ void ftDwlQueue::insertDownload(const DwlDetails & details) {
unsigned int sDwl = totalSystemDwl(); unsigned int sDwl = totalSystemDwl();
RsStackMutex stack(prmtx); RsStackMutex stack(prmtx);
if ((!priorities.empty()) || (sDwl >= downloadLimit)) { if ((!priorities.empty()) || (sDwl > downloadLimit)) {
rsFiles->FileControl(_details.hash, RS_FILE_CTRL_PAUSE); rsFiles->FileControl(_details.hash, RS_FILE_CTRL_PAUSE);
_details.paused = true; _details.paused = true;