[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1767 - GNUnet/src/server
From: |
grothoff |
Subject: |
[GNUnet-SVN] r1767 - GNUnet/src/server |
Date: |
Fri, 19 Aug 2005 18:30:14 -0700 (PDT) |
Author: grothoff
Date: 2005-08-19 18:30:12 -0700 (Fri, 19 Aug 2005)
New Revision: 1767
Modified:
GNUnet/src/server/connection.c
Log:
trying to fix divison by 0
Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c 2005-08-19 23:49:13 UTC (rev 1766)
+++ GNUnet/src/server/connection.c 2005-08-20 01:30:12 UTC (rev 1767)
@@ -689,8 +689,11 @@
4, this is probably a good idea (TM) :-) */
efflen = MALLOC(sizeof(int)*count);
max = available;
- for (i=0;i<count;i++)
- max = gcd(max, entries[i]->len);
+ for (i=0;i<count;i++) {
+ if (entries[i]->len > 0)
+ max = gcd(max, entries[i]->len);
+ }
+ GNUNET_ASSERT(max != 0);
available = available / max;
for (i=0;i<count;i++)
efflen[i] = entries[i]->len / max;
@@ -1535,6 +1538,7 @@
}
/* grow send buffer, insertion sort! */
ne = MALLOC( (be->sendBufferSize+1) * sizeof(SendEntry*));
+ GNUNET_ASSERT(se->len != 0);
apri = (float) se->pri / (float) se->len;
i=0;
while ( (i < be->sendBufferSize) &&
@@ -1868,6 +1872,8 @@
return; /* don't update too frequently, we need at least some
semi-representative sampling! */
}
+ if (timeDifference == 0)
+ timeDifference = 1;
/* build an array containing all BEs */
@@ -1909,6 +1915,7 @@
algorithm, we'd need to compute the new limits separately
and then merge the values; but for now, let's just go
hardcore and adjust all values rapidly */
+ GNUNET_ASSERT(timeDifference != 0);
for (u=0;u<activePeerCount;u++) {
adjustedRR[u] = entries[u]->recently_received * cronMINUTES /
timeDifference / 2;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1767 - GNUnet/src/server,
grothoff <=