mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -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
1 changed files with 11 additions and 7 deletions
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue