gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r20920 - gnunet/src/nse
Date: Tue, 10 Apr 2012 15:25:23 +0200

Author: bartpolot
Date: 2012-04-10 15:25:23 +0200 (Tue, 10 Apr 2012)
New Revision: 20920

Modified:
   gnunet/src/nse/gnunet-service-nse.c
Log:
- Improved doxygen, added debug code

Modified: gnunet/src/nse/gnunet-service-nse.c
===================================================================
--- gnunet/src/nse/gnunet-service-nse.c 2012-04-10 12:52:32 UTC (rev 20919)
+++ gnunet/src/nse/gnunet-service-nse.c 2012-04-10 13:25:23 UTC (rev 20920)
@@ -126,6 +126,12 @@
    */
   int previous_round;
 
+  /**
+   * Where a variable has been modified to cause a bug.
+   * FIXME DELETE AFTER DEBUG
+   */
+  const char *where;
+
 #if ENABLE_HISTOGRAM
 
   /**
@@ -597,7 +603,7 @@
     GNUNET_STATISTICS_update (stats,
                               "# flood messages not generated (lack of 
history)",
                               1, GNUNET_NO);
-    return 0;
+    return 0; // FIXME necessary?
   }
 #if DEBUG_NSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -713,15 +719,17 @@
   struct NSEPeerEntry *peer_entry = value;
   struct GNUNET_TIME_Relative delay;
 
-  if (peer_entry->th != NULL)
+  if (NULL != peer_entry->th)
   {
     peer_entry->previous_round = GNUNET_NO;
+    peer_entry->where =  __FUNCTION__;
     return GNUNET_OK;
   }
-  if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK)
+  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 = __FUNCTION__;
   }
 #if ENABLE_HISTOGRAM
   if (peer_entry->received_messages > 1)
@@ -979,8 +987,8 @@
   {
     /* still stuck in previous round, no point to update, check that
      * we are active here though... */
-    GNUNET_break (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK ||
-                  peer_entry->th != NULL);
+    GNUNET_break (GNUNET_SCHEDULER_NO_TASK != peer_entry->transmit_task ||
+                  NULL != peer_entry->th);
     return GNUNET_OK;
   }
   if (peer_entry->transmit_task != GNUNET_SCHEDULER_NO_TASK)
@@ -1118,8 +1126,10 @@
   }
   if (matching_bits < ntohl (size_estimate_messages[idx].matching_bits))
   {
-    if ((idx < estimate_index) && (peer_entry->previous_round == GNUNET_YES))
+    if ((idx < estimate_index) && (peer_entry->previous_round == GNUNET_YES)) {
       peer_entry->previous_round = GNUNET_NO;
+      peer_entry->where = __FUNCTION__ ;
+    }
     /* push back our result now, that peer is spreading bad information... */
     if (NULL == peer_entry->th)
     {
@@ -1182,7 +1192,8 @@
 
 
 /**
- * Method called whenever a peer connects.
+ * Method called whenever a peer connects. Sets up the PeerEntry and
+ * schedules the initial size info transmission to this peer.
  *
  * @param cls closure
  * @param peer peer identity this notification is about
@@ -1209,12 +1220,14 @@
   peer_entry->transmit_task =
       GNUNET_SCHEDULER_add_delayed (get_transmit_delay (-1), &transmit_task_cb,
                                     peer_entry);
+  peer_entry->where = "core connect";
   GNUNET_STATISTICS_update (stats, "# peers", 1, GNUNET_NO);
 }
 
 
 /**
- * Method called whenever a peer disconnects.
+ * Method called whenever a peer disconnects. Deletes the PeerEntry and cancels
+ * any pending transmission requests to that peer.
  *
  * @param cls closure
  * @param peer peer identity this notification is about
@@ -1237,8 +1250,10 @@
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_CONTAINER_multihashmap_remove (peers, 
&peer->hashPubKey,
                                                        pos));
-  if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK)
+  if (pos->transmit_task != GNUNET_SCHEDULER_NO_TASK) {
     GNUNET_SCHEDULER_cancel (pos->transmit_task);
+    pos->transmit_task = GNUNET_SCHEDULER_NO_TASK;
+  }
   if (pos->th != NULL)
   {
     GNUNET_CORE_notify_transmit_ready_cancel (pos->th);




reply via email to

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