Author: grothoff Date: 2008-03-01 18:37:06 -0700 (Sat, 01 Mar 2008) New Revision: 6495
Modified: GNUnet/src/server/connection.c Log: adjust traffic limits by violation count Modified: GNUnet/src/server/connection.c =================================================================== --- GNUnet/src/server/connection.c 2008-03-01 21:12:08 UTC (rev 6494) +++ GNUnet/src/server/connection.c 2008-03-02 01:37:06 UTC (rev 6495) @@ -159,6 +159,15 @@ #define MAX_SEND_BUFFER_SIZE (EXPECTED_MTU * 8) /** + * How often is another peer allowed to transmit above + * the limit before we shutdown the connection? + * (note that the violation counter also ages and that + * advertised bandwidth limits are adjusted to a + * fraction according to the current violation counter). + */ +#define MAX_VIOLATIONS 10 + +/** * Status constants * * Protocol goes like this: @@ -1791,7 +1800,7 @@ p2pHdr = (GNUNET_TransportPacket_HEADER *) plaintextMsg; p2pHdr->timeStamp = htonl (GNUNET_get_time_int32 (NULL)); p2pHdr->sequenceNumber = htonl (be->lastSequenceNumberSend); - p2pHdr->bandwidth = htonl (be->idealized_limit); + p2pHdr->bandwidth = htonl (be->idealized_limit * (MAX_VIOLATIONS - be->violations) / MAX_VIOLATIONS); p = sizeof (GNUNET_TransportPacket_HEADER); for (i = 0; i < stotal; i++) { @@ -2492,7 +2501,7 @@ { entries[u]->violations++; entries[u]->recently_received = 0; /* "clear" slate */ - if (entries[u]->violations > 10) + if (entries[u]->violations > MAX_VIOLATIONS) { #if DEBUG_CONNECTION IF_GELOG (ectx, _______________________________________________ GNUnet-SVN mailing list GNUnet-SVN@gnu.org http://lists.gnu.org/mailman/listinfo/gnunet-svn