remove ugly ifdef for message tracking
authorNathan S. Evans <evans@in.tum.de>
Tue, 22 Jun 2010 16:38:59 +0000 (16:38 +0000)
committerNathan S. Evans <evans@in.tum.de>
Tue, 22 Jun 2010 16:38:59 +0000 (16:38 +0000)
src/dv/dv.h
src/dv/gnunet-service-dv.c

index 8f0de1825b606cc7c457a866ee83ed3ac75966d9..28a56031ef204a1257b9b36000909b8b2a4153ac 100644 (file)
@@ -229,17 +229,11 @@ typedef struct
 {
   struct GNUNET_MessageHeader header;
 
-#if DEBUG_DV_MESSAGES
   /**
-   * Unique ID for this message.
+   * Unique ID for this message.  Will be zero unless
+   * message tracking is desired.
    */
   uint32_t uid GNUNET_PACKED;
-#else
-  /*
-   * Alignment.
-   */
-  uint32_t reserved GNUNET_PACKED;
-#endif
 
   /**
    * Identity of peer that ultimately sent the message.
index 9cad3dca2fe0ca1f81768014fa4937fb088b5d7b..f2ba74ade35537312ff62a5837c2e93bcafadd08 100644 (file)
@@ -511,12 +511,10 @@ struct DV_SendContext
    */
   struct GNUNET_TIME_Relative timeout;
 
-#if DEBUG_DV_MESSAGES
   /**
    * Unique ID for DV message
    */
   unsigned int uid;
-#endif
 };
 
 
@@ -944,6 +942,8 @@ send_message_via (const struct GNUNET_PeerIdentity *sender,
   toSend->recipient = htonl (recipient_id);
 #if DEBUG_DV_MESSAGES
   toSend->uid = send_context->uid; /* Still sent around in network byte order */
+#else
+  toSend->uid = htonl(0);
 #endif
 
   memcpy (&toSend[1], send_context->message, send_context->message_size);
@@ -1009,7 +1009,6 @@ find_least_cost_peer (void *cls,
   return GNUNET_YES;
 }
 
-#if DEBUG_DV_MESSAGES
 /**
  * Send a DV data message via DV.
  *
@@ -1019,22 +1018,8 @@ find_least_cost_peer (void *cls,
  * @param message the packed message
  * @param message_size size of the message
  * @param importance what priority to send this message with
- * @param uid unique id for this message
  * @param timeout how long to possibly delay sending this message
  */
-#else
-/**
- * Send a DV data message via DV.
- *
- * @param recipient the ultimate recipient of this message
- * @param sender the original sender of the message
- * @param specific_neighbor the specific neighbor to send this message via
- * @param message the packed message
- * @param message_size size of the message
- * @param importance what priority to send this message with
- * @param timeout how long to possibly delay sending this message
- */
-#endif
 static int
 send_message (const struct GNUNET_PeerIdentity * recipient,
               const struct GNUNET_PeerIdentity * sender,
@@ -1042,9 +1027,7 @@ send_message (const struct GNUNET_PeerIdentity * recipient,
               const struct GNUNET_MessageHeader * message,
               size_t message_size,
               unsigned int importance,
-#if DEBUG_DV_MESSAGES
               unsigned int uid,
-#endif
               struct GNUNET_TIME_Relative timeout)
 {
   p2p_dv_MESSAGE_Data *toSend;
@@ -1127,7 +1110,10 @@ send_message (const struct GNUNET_PeerIdentity * recipient,
   toSend->recipient = htonl (recipient_id);
 #if DEBUG_DV_MESSAGES
   toSend->uid = htonl(uid);
+#else
+  toSend->uid = htonl(0);
 #endif
+
 #if DEBUG_DV_PEER_NUMBERS
   GNUNET_CRYPTO_hash_to_enc (&target->identity.hashPubKey, &encPeerTo);
   encPeerTo.encoding[4] = '\0';
@@ -1393,9 +1379,7 @@ static int handle_dv_data_message (void *cls,
                      packed_message,
                      packed_message_size,
                      default_dv_priority,
-#if DEBUG_DV_MESSAGES
                      ntohl(incoming->uid),
-#endif
                      GNUNET_TIME_relative_get_forever());
 
   if (ret != GNUNET_SYSERR)