gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r31709 - in gnunet/src: include transport


From: gnunet
Subject: [GNUnet-SVN] r31709 - in gnunet/src: include transport
Date: Mon, 23 Dec 2013 18:10:38 +0100

Author: grothoff
Date: 2013-12-23 18:10:38 +0100 (Mon, 23 Dec 2013)
New Revision: 31709

Modified:
   gnunet/src/include/gnunet_ats_service.h
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/gnunet-service-transport_neighbours.c
   gnunet/src/transport/plugin_transport_tcp.c
Log:
-more logging and doxygen fixes

Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h     2013-12-23 15:26:04 UTC (rev 
31708)
+++ gnunet/src/include/gnunet_ats_service.h     2013-12-23 17:10:38 UTC (rev 
31709)
@@ -531,7 +531,6 @@
 
 /**
  * Handle for address suggestion requests
- *
  */
 struct GNUNET_ATS_SuggestHandle;
 
@@ -550,14 +549,14 @@
  * @param bandwidth_out assigned outbound bandwidth for the connection
  * @param bandwidth_in assigned inbound bandwidth for the connection
  * @param ats performance data for the address (as far as known)
- * @param ats_count number of performance records in 'ats'
+ * @param ats_count number of performance records in @a ats
  */
 typedef void
 (*GNUNET_ATS_AddressSuggestionCallback) (void *cls,
-    const struct GNUNET_HELLO_Address * address, struct Session * session,
+    const struct GNUNET_HELLO_Address *address, struct Session *session,
     struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
     struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-    const struct GNUNET_ATS_Information * ats, uint32_t ats_count);
+    const struct GNUNET_ATS_Information *ats, uint32_t ats_count);
 
 /**
  * Initialize the ATS subsystem.
@@ -588,8 +587,9 @@
  */
 void
 GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_PeerIdentity *peer);
+                          const struct GNUNET_PeerIdentity *peer);
 
+
 /**
  * We would like to establish a new connection with a peer.  ATS
  * should suggest a good address to begin with.
@@ -600,8 +600,9 @@
  */
 struct GNUNET_ATS_SuggestHandle *
 GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_PeerIdentity *peer);
+                            const struct GNUNET_PeerIdentity *peer);
 
+
 /**
  * We want to cancel ATS suggesting addresses for a peer.
  *
@@ -610,8 +611,9 @@
  */
 void
 GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_PeerIdentity *peer);
+                                   const struct GNUNET_PeerIdentity *peer);
 
+
 /**
  * Convert a ATS property to a string
  *
@@ -621,6 +623,7 @@
 const char *
 GNUNET_ATS_print_property_type (uint32_t type);
 
+
 /**
  * Convert a GNUNET_ATS_NetworkType to a string
  *
@@ -630,6 +633,7 @@
 const char *
 GNUNET_ATS_print_network_type (uint32_t net);
 
+
 /**
  * Returns where the address is located: LAN or WAN or ...
  * @param sh the GNUNET_ATS_SchedulingHandle handle
@@ -639,20 +643,24 @@
  */
 struct GNUNET_ATS_Information
 GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct sockaddr * addr, socklen_t addrlen);
+                             const struct sockaddr * addr,
+                             socklen_t addrlen);
 
+
 /**
  * Test if a address and a session is known to ATS
  *
  * @param sh the scheduling handle
  * @param address the address
  * @param session the session
- * @return GNUNET_YES or GNUNET_NO
+ * @return #GNUNET_YES or #GNUNET_NO
  */
 int
 GNUNET_ATS_session_known (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_HELLO_Address *address, struct Session *session);
+                          const struct GNUNET_HELLO_Address *address,
+                          struct Session *session);
 
+
 /**
  * We have a new address ATS should know. Addresses have to be added with this
  * function before they can be: updated, set in use and destroyed
@@ -661,13 +669,16 @@
  * @param address the address
  * @param session session handle (if available)
  * @param ats performance data for the address
- * @param ats_count number of performance records in 'ats'
+ * @param ats_count number of performance records in @a ats
  */
 int
 GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_HELLO_Address *address, struct Session *session,
-    const struct GNUNET_ATS_Information *ats, uint32_t ats_count);
+                        const struct GNUNET_HELLO_Address *address,
+                        struct Session *session,
+                        const struct GNUNET_ATS_Information *ats,
+                        uint32_t ats_count);
 
+
 /**
  * We have updated performance statistics for a given address.  Note
  * that this function can be called for addresses that are currently
@@ -680,28 +691,33 @@
  * @param address updated address
  * @param session session handle (if available)
  * @param ats performance data for the address
- * @param ats_count number of performance records in 'ats'
- * @return GNUNET_OK or GNUNET_SYSERR
+ * @param ats_count number of performance records in @a ats
+ * @return #GNUNET_OK or #GNUNET_SYSERR
  */
 int
 GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_HELLO_Address *address, struct Session *session,
-    const struct GNUNET_ATS_Information *ats, uint32_t ats_count);
+                           const struct GNUNET_HELLO_Address *address,
+                           struct Session *session,
+                           const struct GNUNET_ATS_Information *ats,
+                           uint32_t ats_count);
 
+
 /**
  * An address is now in use or not used any more.
  *
  * @param sh handle
  * @param address the address
  * @param session session handle
- * @param in_use GNUNET_YES if this address is now used, GNUNET_NO
+ * @param in_use #GNUNET_YES if this address is now used, #GNUNET_NO
  * if address is not used any more
  */
 void
 GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_HELLO_Address *address, struct Session *session,
-    int in_use);
+                           const struct GNUNET_HELLO_Address *address,
+                           struct Session *session,
+                           int in_use);
 
+
 /**
  * A session got destroyed, stop including it as a valid address.
  *
@@ -711,8 +727,10 @@
  */
 void
 GNUNET_ATS_address_destroyed (struct GNUNET_ATS_SchedulingHandle *sh,
-    const struct GNUNET_HELLO_Address *address, struct Session *session);
+                              const struct GNUNET_HELLO_Address *address,
+                              struct Session *session);
 
+
 /* ******************************** Performance API 
***************************** */
 
 /**

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2013-12-23 15:26:04 UTC 
(rev 31708)
+++ gnunet/src/transport/gnunet-service-transport.c     2013-12-23 17:10:38 UTC 
(rev 31709)
@@ -561,7 +561,11 @@
   }
 
   if (GNUNET_YES == GNUNET_ATS_session_known (GST_ats, address, session))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "ATS already knows the address, not passing it on again\n");
     return;
+  }
 
   net = papi->get_network (NULL, session);
   if (GNUNET_ATS_NET_UNSPECIFIED == net)
@@ -754,7 +758,7 @@
   uint32_t bw_out = ntohl (bandwidth_out.value__);
 
   /* ATS tells me to disconnect from peer */
-  if ((bw_in == 0) && (bw_out == 0))
+  if ((0 == bw_in) && (0 == bw_out))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 "ATS tells me to disconnect from peer `%s'\n",

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2013-12-23 
15:26:04 UTC (rev 31708)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2013-12-23 
17:10:38 UTC (rev 31709)
@@ -497,7 +497,7 @@
 
   /**
    * Timestamp we should include in our next CONNECT_ACK message.
-   * (only valid if 'send_connect_ack' is GNUNET_YES).  Used to build
+   * (only valid if 'send_connect_ack' is #GNUNET_YES).  Used to build
    * our CONNECT_ACK message.
    */
   struct GNUNET_TIME_Absolute connect_ack_timestamp;
@@ -908,6 +908,9 @@
   struct GNUNET_TRANSPORT_PluginFunctions *papi;
   struct GNUNET_HELLO_Address *backup_primary;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Freeing neighbur state of peer `%s'\n",
+              GNUNET_i2s (&n->id));
   n->is_active = NULL; /* always free'd by its own continuation! */
 
   /* fail messages currently in the queue */
@@ -1677,6 +1680,9 @@
   struct GNUNET_TRANSPORT_PluginFunctions *papi;
   struct SessionConnectMessage connect_msg;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Sending SESSION_CONNECT message to peer %s\n",
+              GNUNET_i2s (&na->address->peer));
   if (NULL == (papi = GST_plugins_find (na->address->transport_name)))
   {
     GNUNET_break (0);
@@ -1733,6 +1739,9 @@
   struct GNUNET_TRANSPORT_PluginFunctions *papi;
   struct SessionConnectMessage connect_msg;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Sending CONNECT_ACK to peer `%s'\n",
+              GNUNET_i2s (peer));
   if (NULL == (papi = GST_plugins_find (address->transport_name)))
   {
     GNUNET_break (0);
@@ -1925,7 +1934,9 @@
               GNUNET_i2s (peer),
               (GNUNET_OK == result) ? "allowed" : "FORBIDDEN");
   if (GNUNET_OK == result)
+  {
     GST_ats_add_address (bcc->na.address, bcc->na.session, NULL, 0);
+  }
   else
   {
     /* Blacklist disagreed on connecting to a peer with this address
@@ -1936,7 +1947,17 @@
     GNUNET_ATS_address_destroyed (GST_ats, bcc->na.address, NULL);
   }
   if (NULL == (n = lookup_neighbour (peer)))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "No neighbor entry for peer `%s', ignoring blacklist result\n",
+                GNUNET_i2s (peer));
     goto cleanup; /* nobody left to care about new address */
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received blacklist result for peer `%s' in state %s/%d\n",
+              GNUNET_i2s (peer),
+              print_state (n->state),
+              n->send_connect_ack);
   switch (n->state)
   {
   case S_NOT_CONNECTED:
@@ -1960,7 +1981,12 @@
                                        n->connect_ack_timestamp);
     }
     if (GNUNET_YES != address_matches (&bcc->na, &n->primary_address))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Blacklist result for peer %s is for non-primary address, 
ignored\n",
+                  GNUNET_i2s (peer));
       break; /* result for an address we currently don't care about */
+    }
     if (GNUNET_OK == result)
     {
       n->timeout = GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT);
@@ -1989,6 +2015,9 @@
     n->state = S_CONNECT_RECV_ATS;
     n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
     GNUNET_ATS_reset_backoff (GST_ats, peer);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Suggesting address for peer %s to ATS\n",
+                GNUNET_i2s (peer));
     n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, peer);
     break;
   case S_CONNECT_RECV_ATS:
@@ -2057,7 +2086,11 @@
                                        n->connect_ack_timestamp);
     }
     if (GNUNET_YES != address_matches (&bcc->na, &n->primary_address))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Blacklist result ignored, as it is not for our primary 
address\n");
       break; /* result for an address we currently don't care about */
+    }
     if (GNUNET_OK == result)
     {
       n->state = S_RECONNECT_SENT;
@@ -2083,7 +2116,11 @@
     break;
   case S_CONNECTED_SWITCHING_BLACKLIST:
     if (GNUNET_YES != address_matches (&bcc->na, &n->alternative_address))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Blacklist result ignored, as it is not for our primary 
address\n");
       break; /* result for an address we currently don't care about */
+    }
     if (GNUNET_OK == result)
     {
       send_session_connect (&n->alternative_address);
@@ -2146,6 +2183,9 @@
   struct BlackListCheckContext *bcc;
   struct GST_BlacklistCheck *bc;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Checking peer `%s' against blacklist\n",
+              GNUNET_i2s (peer));
   bcc = GNUNET_new (struct BlackListCheckContext);
   bcc->na.address = GNUNET_HELLO_address_copy (address);
   bcc->na.session = session;
@@ -2211,6 +2251,11 @@
   n->send_connect_ack = 1;
   n->connect_ack_timestamp = ts;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Received SESSION_CONNECT for peer `%s' in state %s/%d\n",
+              GNUNET_i2s (peer),
+              print_state (n->state),
+              n->send_connect_ack);
   switch (n->state)
   {
   case S_NOT_CONNECTED:
@@ -2312,14 +2357,26 @@
   struct NeighbourMapEntry *n;
   struct GNUNET_TRANSPORT_PluginFunctions *papi;
 
-  GNUNET_assert (address->transport_name != NULL);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "ATS has decided on an address for peer %s\n",
+              GNUNET_i2s (peer));
+  GNUNET_assert (NULL != address->transport_name);
   if (NULL == (n = lookup_neighbour (peer)))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Peer %s is unknown, suggestion ignored\n",
+                GNUNET_i2s (peer));
     return;
+  }
 
   /* Obtain an session for this address from plugin */
   if (NULL == (papi = GST_plugins_find (address->transport_name)))
   {
     /* we don't have the plugin for this address */
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Plugin `%s' is unknown, suggestion for peer %s ignored\n",
+                address->transport_name,
+                GNUNET_i2s (peer));
     GNUNET_ATS_address_destroyed (GST_ats, address, NULL);
     return;
   }

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2013-12-23 15:26:04 UTC (rev 
31708)
+++ gnunet/src/transport/plugin_transport_tcp.c 2013-12-23 17:10:38 UTC (rev 
31709)
@@ -61,7 +61,7 @@
 struct WelcomeMessage
 {
   /**
-   * Type is GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME.
+   * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME.
    */
   struct GNUNET_MessageHeader header;
 
@@ -80,7 +80,7 @@
 struct TCP_NAT_ProbeMessage
 {
   /**
-   * Type is GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE.
+   * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE.
    */
   struct GNUNET_MessageHeader header;
 




reply via email to

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