gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r20944 - gnunet/src/nse
Date: Wed, 11 Apr 2012 16:40:54 +0200

Author: bartpolot
Date: 2012-04-11 16:40:54 +0200 (Wed, 11 Apr 2012)
New Revision: 20944

Modified:
   gnunet/src/nse/gnunet-service-nse.c
Log:
- Fixed 2202, removed debug stuff

Modified: gnunet/src/nse/gnunet-service-nse.c
===================================================================
--- gnunet/src/nse/gnunet-service-nse.c 2012-04-11 14:13:47 UTC (rev 20943)
+++ gnunet/src/nse/gnunet-service-nse.c 2012-04-11 14:40:54 UTC (rev 20944)
@@ -126,14 +126,6 @@
    */
   int previous_round;
 
-  /**
-   * Where a variable has been modified to cause a bug.
-   * FIXME DELETE AFTER DEBUG
-   */
-  int where_task;
-  int where_round;
-  int where_th;
-
 #if ENABLE_HISTOGRAM
 
   /**
@@ -577,7 +569,6 @@
   unsigned int idx;
 
   peer_entry->th = NULL;
-  peer_entry->where_th = __LINE__;
   if (NULL == buf)
   {
     /* client disconnected */
@@ -606,7 +597,7 @@
     GNUNET_STATISTICS_update (stats,
                               "# flood messages not generated (lack of 
history)",
                               1, GNUNET_NO);
-    return 0; // FIXME necessary?
+    return 0;
   }
 #if DEBUG_NSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -644,8 +635,7 @@
   struct NSEPeerEntry *peer_entry = cls;
 
   peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
-  peer_entry->where_task = __LINE__;
-  
+
   GNUNET_assert (NULL == peer_entry->th);
   peer_entry->th =
       GNUNET_CORE_notify_transmit_ready (coreAPI, GNUNET_NO, NSE_PRIORITY,
@@ -654,7 +644,6 @@
                                          sizeof (struct
                                                  GNUNET_NSE_FloodMessage),
                                          &transmit_ready, peer_entry);
-  peer_entry->where_th = __LINE__;
 }
 
 
@@ -728,14 +717,12 @@
   if (NULL != peer_entry->th)
   {
     peer_entry->previous_round = GNUNET_NO;
-    peer_entry->where_round = __LINE__;
     return GNUNET_OK;
   }
   if (GNUNET_SCHEDULER_NO_TASK != peer_entry->transmit_task)
   {
     GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
     peer_entry->previous_round = GNUNET_NO;
-    peer_entry->where_round = __LINE__;
   }
 #if ENABLE_HISTOGRAM
   if (peer_entry->received_messages > 1)
@@ -997,10 +984,6 @@
                   NULL == peer_entry->th)
     {
         GNUNET_break (0);
-        GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "ROUND%d TASK%d TH%d\n",
-                    peer_entry->where_round,
-                    peer_entry->where_task,
-                    peer_entry->where_th);
     }
     return GNUNET_OK;
   }
@@ -1008,7 +991,6 @@
   {
     GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
     peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
-    peer_entry->where_task = __LINE__;
   }
   delay = get_transmit_delay (0);
   peer_entry->transmit_task =
@@ -1130,13 +1112,11 @@
     {
       GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
       peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
-      peer_entry->where_task = __LINE__;
     }
     if (peer_entry->th != NULL)
     {
       GNUNET_CORE_notify_transmit_ready_cancel (peer_entry->th);
       peer_entry->th = NULL;
-      peer_entry->where_th = __LINE__;
     }
     return GNUNET_OK;
   }
@@ -1144,7 +1124,6 @@
   {
     if ((idx < estimate_index) && (peer_entry->previous_round == GNUNET_YES)) {
       peer_entry->previous_round = GNUNET_NO;
-      peer_entry->where_round = __LINE__;
     }
     /* push back our result now, that peer is spreading bad information... */
     if (NULL == peer_entry->th)
@@ -1170,19 +1149,21 @@
   /* cancel transmission from us to this peer for this round */
   if (idx == estimate_index)
   {
+      /* Cancel transmission in the other direction, as this peer clearly has
+       up-to-date information already. Even if we didn't talk to this peer in
+       the previous round, we should no longer send it stale information as it
+       told us about the current round! */
+      peer_entry->previous_round = GNUNET_YES;
       /* cancel any activity for current round */
-      // FIXME what if previous round was pending? (lost message?)
       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->where_task = __LINE__;
       }
       if (peer_entry->th != NULL)
       {
         GNUNET_CORE_notify_transmit_ready_cancel (peer_entry->th);
         peer_entry->th = NULL;
-        peer_entry->where_th = __LINE__;
       }
   }
   else
@@ -1240,9 +1221,6 @@
       GNUNET_SCHEDULER_add_delayed (get_transmit_delay (-1), &transmit_task_cb,
                                     peer_entry);
   GNUNET_STATISTICS_update (stats, "# peers", 1, GNUNET_NO);
-  peer_entry->where_task = 0;
-  peer_entry->where_round = __LINE__;
-  peer_entry->where_th = __LINE__;
 }
 
 
@@ -1274,13 +1252,11 @@
   if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) {
     GNUNET_SCHEDULER_cancel (pos->transmit_task);
     pos->transmit_task = GNUNET_SCHEDULER_NO_TASK;
-    pos->where_task = __LINE__;
   }
   if (pos->th != NULL)
   {
     GNUNET_CORE_notify_transmit_ready_cancel (pos->th);
     pos->th = NULL;
-    pos->where_th = __LINE__;
   }
   GNUNET_free (pos);
   GNUNET_STATISTICS_update (stats, "# peers", -1, GNUNET_NO);




reply via email to

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