aMule Bug Tracker - aMule
View Issue Details
0000494aMuleSharedfilespublic2005-06-29 14:162005-07-05 12:29
eyalzo 
Xaignar 
normalminoralways
resolvedfixed 
2.0.3 
SVN 
0000494: Clients with score zero stay in queue
Some clients in upload queue might get score of zero, and stay there (almost) forever. It makes all the new uploaders to get into queue, even when there are some empty slots waiting for them.
The problem is that direct-add is used only when upload-queue is empty. But it won't be empty if these guys won't get their slot or kicked-out.
It can be solved in one of several ways. I decided to give them a slot.
The easiest way is to change UploadQueue.cpp, AddUpNextClient(), the line:

if ( cur_score > bestscore){

To:

if ( cur_score >= bestscore){

You can also use signed-int for bestscore, and start with -1.
No tags attached.
Issue History
2005-06-29 14:16eyalzoNew Issue
2005-07-05 03:28XaignarStatusnew => acknowledged
2005-07-05 12:29XaignarStatusacknowledged => resolved
2005-07-05 12:29XaignarFixed in Version => CVS
2005-07-05 12:29XaignarResolutionopen => fixed
2005-07-05 12:29XaignarAssigned To => Xaignar
2005-07-05 12:29XaignarNote Added: 0001122

Notes
(0001122)
Xaignar   
2005-07-05 12:29   
Thanks you for the report. The following fix has been applied:

===================================================================
--- src/UploadQueue.cpp (revision 4715)
+++ src/UploadQueue.cpp (working copy)
@@ -80,11 +80,13 @@
        m_lastCalculatedDataRateTick = 0;
 }
 
-void CUploadQueue::AddUpNextClient(CUpDownClient* directadd){
+
+void CUploadQueue::AddUpNextClient(CUpDownClient* directadd)
+{
        POSITION toadd = 0;
        POSITION toaddlow = 0;
- uint32 bestscore = 0;
- uint32 bestlowscore = 0;
+ sint64 bestscore = -1;
+ sint64 bestlowscore = -1;
 
        CUpDownClient* newclient;
        // select next client or use given client
@@ -113,8 +115,9 @@
                                continue;
                        }
                        // finished clearing
- uint32 cur_score = cur_client->GetScore(true);
- if ( cur_score > bestscore){
+
+ sint64 cur_score = cur_client->GetScore(true);
+ if (cur_score > bestscore) {
                                bestscore = cur_score;
                                toadd = pos2;
                        } else {
===================================================================

Cheers,
 Xaignar