mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
6f69a9edf3
commit
e69351dda9
@ -29,7 +29,7 @@ void ftDwlQueue::run()
|
||||
|
||||
while (1) {
|
||||
|
||||
#ifdef WIN_32
|
||||
#ifdef WIN32
|
||||
Sleep(1000);
|
||||
#else
|
||||
sleep(1);
|
||||
@ -37,16 +37,20 @@ void ftDwlQueue::run()
|
||||
|
||||
unsigned int sDwl = totalSystemDwl();
|
||||
unsigned int qDwl = totalQueuedDwl();
|
||||
unsigned int dwl = 0;
|
||||
|
||||
/* we have to know if one ore more downloads are
|
||||
* paused in the queue and the next of them will
|
||||
* not exceed download limit*/
|
||||
if (!(qDwl && (sDwl - 1 < downloadLimit))) continue;
|
||||
if (sDwl - qDwl >= 0) {
|
||||
dwl = sDwl - qDwl; /* real downloads, not in the queue */
|
||||
}
|
||||
|
||||
/* we have to know if the next download from
|
||||
* queue will exceed the download limit */
|
||||
if (dwl + 1 > downloadLimit) continue;
|
||||
|
||||
DwlDetails details;
|
||||
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 */
|
||||
|
||||
if (details.paused == true) {
|
||||
@ -115,7 +119,7 @@ void ftDwlQueue::insertDownload(const DwlDetails & details) {
|
||||
unsigned int sDwl = totalSystemDwl();
|
||||
|
||||
RsStackMutex stack(prmtx);
|
||||
if ((!priorities.empty()) || (sDwl >= downloadLimit)) {
|
||||
if ((!priorities.empty()) || (sDwl > downloadLimit)) {
|
||||
rsFiles->FileControl(_details.hash, RS_FILE_CTRL_PAUSE);
|
||||
_details.paused = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user