gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r2192 - GNUnet/src/applications/gap


From: grothoff
Subject: [GNUnet-SVN] r2192 - GNUnet/src/applications/gap
Date: Fri, 14 Oct 2005 05:38:15 -0700 (PDT)

Author: grothoff
Date: 2005-10-14 05:38:14 -0700 (Fri, 14 Oct 2005)
New Revision: 2192

Modified:
   GNUnet/src/applications/gap/gap.c
Log:
fix

Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c   2005-10-14 12:14:42 UTC (rev 2191)
+++ GNUnet/src/applications/gap/gap.c   2005-10-14 12:38:14 UTC (rev 2192)
@@ -935,12 +935,14 @@
     rankingSum = 0;
     for (i=0;i<8*BITMAP_SIZE;i++)
       rankingSum += qr->rankings[i];
-    if ( (rankingSum != 0) &&
-        (qr->activeConnections > 0) ) {
+    if (qr->activeConnections > 0) {
       /* select 4 peers for forwarding */
       for (i=0;i<4;i++) {
        unsigned long long sel;
        unsigned long long pos;
+
+       if (rankingSum == 0)
+         break;
        sel = randomi64(rankingSum);
        pos = 0;        
        for (j=0;j<8*BITMAP_SIZE;j++) {
@@ -954,12 +956,6 @@
          }
        }
       }
-    } else {
-      /* no bias available, go random! */
-      if (qr->activeConnections > 0) {
-       for (i=4*BITMAP_SIZE*8/qr->activeConnections-1;i>=0;i--)
-         setBit(qr, randomi(BITMAP_SIZE)*8); /* select 4 random nodes */
-      }        
     }
     FREE(qr->rankings);
     qr->rankings = NULL;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]