gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10821 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r10821 - gnunet/src/transport
Date: Tue, 6 Apr 2010 14:02:02 +0200

Author: grothoff
Date: 2010-04-06 14:02:02 +0200 (Tue, 06 Apr 2010)
New Revision: 10821

Modified:
   gnunet/src/transport/gnunet-service-transport.c
Log:
better quota violation handling

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2010-04-06 11:30:35 UTC 
(rev 10820)
+++ gnunet/src/transport/gnunet-service-transport.c     2010-04-06 12:02:02 UTC 
(rev 10821)
@@ -3178,25 +3178,26 @@
                                                              (ssize_t) msize))
            {
              n->quota_violation_count++;
-             GNUNET_log (GNUNET_ERROR_TYPE_WARNING |
-                         GNUNET_ERROR_TYPE_BULK,
-                         _
-                         ("Bandwidth quota (%u b/s) violation detected (total 
of %u).\n"), 
+#if DEBUG_TRANSPORT
+             GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,                        
+                         "Bandwidth quota (%u b/s) violation detected (total 
of %u).\n", 
                          n->in_tracker.available_bytes_per_s__,
                          n->quota_violation_count);
-             if (n->quota_violation_count > QUOTA_VIOLATION_DROP_THRESHOLD)
+#endif
+             /* Discount 32k per violation */
+             GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker,
+                                               - 32 * 1024);           
+           }
+         else 
+           {
+             if (n->quota_violation_count > 0)
                {
-                 /* since we'll be dropping, only count this message for half 
so that
-                    peers that send aggressively at the quota don't get 
"punished"
-                    forever */
+                 /* try to add 32k back */
                  GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker,
-                                                   - (ssize_t) msize / 2);
+                                                   32 * 1024);
+                 n->quota_violation_count--;
                }
            }
-         else 
-           {
-             n->quota_violation_count = 0; /* back within limits */
-           }
          GNUNET_STATISTICS_update (stats,
                                    gettext_noop ("# payload received from 
other peers"),
                                    msize,





reply via email to

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