gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r16156 - gnunet/src/nse


From: gnunet
Subject: [GNUnet-SVN] r16156 - gnunet/src/nse
Date: Sat, 23 Jul 2011 23:06:27 +0200

Author: grothoff
Date: 2011-07-23 23:06:27 +0200 (Sat, 23 Jul 2011)
New Revision: 16156

Modified:
   gnunet/src/nse/gnunet-service-nse.c
   gnunet/src/nse/nse.h
   gnunet/src/nse/test_nse.conf
Log:
success

Modified: gnunet/src/nse/gnunet-service-nse.c
===================================================================
--- gnunet/src/nse/gnunet-service-nse.c 2011-07-23 20:27:17 UTC (rev 16155)
+++ gnunet/src/nse/gnunet-service-nse.c 2011-07-23 21:06:27 UTC (rev 16156)
@@ -45,8 +45,6 @@
 #include "gnunet_nse_service.h"
 #include "nse.h"
 
-#define DEBUG_NSE GNUNET_YES
-
 /**
  * Over how many values do we calculate the weighted average?
  */
@@ -106,7 +104,8 @@
 
   /**
    * Did we receive or send a message about the previous round
-   * to this peer yet?  
+   * to this peer yet?   GNUNET_YES if the previous round has
+   * been taken care of.
    */
   int previous_round;
 };
@@ -338,6 +337,7 @@
                      const struct GNUNET_MessageHeader *message)
 {
   struct GNUNET_NSE_ClientMessage em;
+
 #if DEBUG_NSE
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 
             "Received START message from client\n");
@@ -364,7 +364,7 @@
   // x is matching_bits
   // p' is current_size_estimate
   return ((double) GNUNET_NSE_INTERVAL.rel_value / (double) 2.0)
-    - ((GNUNET_NSE_INTERVAL.rel_value / M_PI) * atan (current_size_estimate - 
matching_bits));
+    - ((GNUNET_NSE_INTERVAL.rel_value / M_PI) * atan (matching_bits - 
current_size_estimate));
 }
 
 
@@ -430,6 +430,11 @@
       /* previous round is randomized between 0 and 50 ms */
       ret.rel_value = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
                                                50);
+#if DEBUG_NSE
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 
+                "Transmitting previous round behind schedule in %llu ms\n",
+                (unsigned long long) ret.rel_value);
+#endif
       return ret;
     case 0:
       /* current round is based on best-known matching_bits */
@@ -437,6 +442,13 @@
       dist_delay = get_matching_bits_delay (matching_bits);
       dist_delay += get_delay_randomization (matching_bits).rel_value;
       ret.rel_value = (uint64_t) dist_delay;
+#if DEBUG_NSE
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 
+                "For round %llu, delay for %u matching bits is %llu ms\n",
+                (unsigned long long) current_timestamp.abs_value,
+                (unsigned int) matching_bits,
+                (unsigned long long) ret.rel_value);
+#endif
       /* now consider round start time and add delay to it */
       tgt = GNUNET_TIME_absolute_add (current_timestamp, ret);
       return GNUNET_TIME_absolute_get_remaining (tgt);
@@ -479,16 +491,11 @@
       return 0;
     }
   GNUNET_assert (size >= sizeof (struct GNUNET_NSE_FloodMessage));
-#if DEBUG_NSE > 1
-  GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 
-             "Sending size estimate to `%s'\n",
-             GNUNET_i2s (&peer_entry->id));
-#endif
   idx = estimate_index;
-  if (peer_entry->previous_round == GNUNET_YES)
+  if (peer_entry->previous_round == GNUNET_NO)
     {
-      idx = (idx + HISTORY_SIZE -1) % HISTORY_SIZE;
-      peer_entry->previous_round = GNUNET_NO;
+      idx = (idx + HISTORY_SIZE - 1) % HISTORY_SIZE;
+      peer_entry->previous_round = GNUNET_YES;
       peer_entry->transmit_task = GNUNET_SCHEDULER_add_delayed 
(get_transmit_delay (0),
                                                                &transmit_task,
                                                                peer_entry);
@@ -502,6 +509,13 @@
                                GNUNET_NO);
       return 0; 
     }
+#if DEBUG_NSE
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
+             "In round %llu, sending to `%s' estimate with %u bits\n",
+             (unsigned long long) GNUNET_TIME_absolute_ntoh 
(size_estimate_messages[idx].timestamp).abs_value,
+             GNUNET_i2s (&peer_entry->id),
+             (unsigned int) ntohl (size_estimate_messages[idx].matching_bits));
+#endif
   if (ntohl (size_estimate_messages[idx].hop_count) == 0) 
     GNUNET_STATISTICS_update (stats, 
                              "# flood messages started", 
@@ -884,7 +898,7 @@
     return GNUNET_OK; /* already active */
   if (peer_entry == exclude)
     return GNUNET_OK; /* trigger of the update */
-  if (peer_entry->previous_round == GNUNET_YES)
+  if (peer_entry->previous_round == GNUNET_NO)
     {
       /* still stuck in previous round, no point to update, check that 
         we are active here though... */
@@ -1003,14 +1017,13 @@
       /* cancel transmission from us to this peer for this round */
       if (idx == estimate_index)
        {
-         if (peer_entry->previous_round == GNUNET_NO)
+         if (peer_entry->previous_round == GNUNET_YES)
            {
              /* cancel any activity for current round */
              if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK)
                {
                  GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
                  peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
-                 peer_entry->previous_round = GNUNET_NO;
                }
              if (peer_entry->th != NULL)
                {
@@ -1022,9 +1035,8 @@
       else
        {
          /* cancel previous round only */
-         peer_entry->previous_round = GNUNET_NO;
-       }
- 
+         peer_entry->previous_round = GNUNET_YES;
+       } 
     }
   if (matching_bits <= ntohl (size_estimate_messages[idx].matching_bits)) 
     {

Modified: gnunet/src/nse/nse.h
===================================================================
--- gnunet/src/nse/nse.h        2011-07-23 20:27:17 UTC (rev 16155)
+++ gnunet/src/nse/nse.h        2011-07-23 21:06:27 UTC (rev 16156)
@@ -30,7 +30,7 @@
 
 #include "gnunet_common.h"
 
-#define DEBUG_NSE GNUNET_YES
+#define DEBUG_NSE GNUNET_NO
 
 #define VERIFY_CRYPTO GNUNET_NO
 

Modified: gnunet/src/nse/test_nse.conf
===================================================================
--- gnunet/src/nse/test_nse.conf        2011-07-23 20:27:17 UTC (rev 16155)
+++ gnunet/src/nse/test_nse.conf        2011-07-23 21:06:27 UTC (rev 16156)
@@ -49,7 +49,7 @@
 AUTOSTART = NO
 
 [testing]
-NUM_PEERS = 10
+NUM_PEERS = 100
 WEAKRANDOM = YES
 TOPOLOGY = NONE
 CONNECT_TOPOLOGY = SMALL_WORLD_RING




reply via email to

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