gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15440 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r15440 - gnunet/src/transport
Date: Mon, 6 Jun 2011 13:26:59 +0200

Author: grothoff
Date: 2011-06-06 13:26:59 +0200 (Mon, 06 Jun 2011)
New Revision: 15440

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/plugin_transport_tcp.c
Log:
indentation fixed, logging

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-06-06 11:14:05 UTC 
(rev 15439)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-06-06 11:26:59 UTC 
(rev 15440)
@@ -4003,7 +4003,7 @@
  */
 static void
 handle_payload_message (const struct GNUNET_MessageHeader *message,
-                                               struct NeighbourList *n)
+                       struct NeighbourList *n)
 {
   struct InboundMessage *im;
   struct TransportClient *cpos;
@@ -4014,7 +4014,7 @@
     {
 #if DEBUG_TRANSPORT
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Received message of type %u and size %u from `%4s', but no 
pong yet!!\n",
+                  "Received message of type %u and size %u from `%4s', but no 
pong yet!\n",
                   ntohs (message->type),
                   ntohs (message->size),
                   GNUNET_i2s (&n->id));
@@ -5347,11 +5347,11 @@
   uint16_t msize;
   struct NeighbourList *n;
   struct GNUNET_TIME_Relative ret;
-  if (is_blacklisted (peer, plugin))
-    return GNUNET_TIME_UNIT_FOREVER_REL;
   uint32_t distance;
   int c;
 
+  if (is_blacklisted (peer, plugin))
+    return GNUNET_TIME_UNIT_FOREVER_REL;
   n = find_neighbour (peer);
   if (n == NULL)
     n = setup_new_neighbour (peer, GNUNET_YES);
@@ -5363,17 +5363,12 @@
   distance = 1;
 
   for (c=0; c<ats_count; c++)
-  {
-         if (ntohl(ats_data[c].type) == 
GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE)
-         {
-                 distance = ntohl(ats_data[c].value);
-         }
-  }
-
+    if (ntohl(ats_data[c].type) == GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE)
+      distance = ntohl(ats_data[c].value);
+  
   /* notify ATS about incoming data */
   //ats_notify_ats_data(peer, ats_data);
 
-
   if (message != NULL)
     {
       if ( (session != NULL) ||
@@ -5385,17 +5380,14 @@
                                         sender_address_len);
       if (peer_address != NULL)
        {
-
-      update_addr_ats(peer_address, ats_data, ats_count);
-      update_addr_value(peer_address, distance, 
GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
-
-      peer_address->distance = distance;
+         update_addr_ats(peer_address, ats_data, ats_count);
+         update_addr_value(peer_address, distance, 
GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+         
+         peer_address->distance = distance;
          if (GNUNET_YES == peer_address->validated)
            mark_address_connected (peer_address);
          peer_address->timeout
-           =
-           GNUNET_TIME_relative_to_absolute
-           (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
+           = GNUNET_TIME_relative_to_absolute 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
          schedule_next_ping (peer_address);
        }
       /* update traffic received amount ... */
@@ -5430,32 +5422,32 @@
        }
     if ((ntohs(message->type) == GNUNET_MESSAGE_TYPE_TRANSPORT_ATS) &&
        (ntohs(message->size) == (sizeof (struct GNUNET_MessageHeader) + sizeof 
(uint32_t))))
-    {
+      {
        uint32_t value =  ntohl(*((uint32_t *) &message[1]));
        //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 
"GNUNET_MESSAGE_TYPE_TRANSPORT_ATS: %i \n", value);
        /* Force ressource and quality update */
        if (value == 4)
-       {
-               ats->stat.modified_resources = GNUNET_YES;
-               ats->stat.modified_quality = GNUNET_YES;
-       }
+         {
+           ats->stat.modified_resources = GNUNET_YES;
+           ats->stat.modified_quality = GNUNET_YES;
+         }
        /* Force cost update */
        if (value == 3)
-               ats->stat.modified_resources = GNUNET_YES;
+         ats->stat.modified_resources = GNUNET_YES;
        /* Force quality update */
        if (value == 2)
-               ats->stat.modified_quality = GNUNET_YES;
+         ats->stat.modified_quality = GNUNET_YES;
        /* Force full rebuild */
        if (value == 1)
-               ats->stat.recreate_problem = GNUNET_YES;
-    }
-
+         ats->stat.recreate_problem = GNUNET_YES;
+      }
+    
 #if DEBUG_PING_PONG
-          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                      "Received message of type %u and size %u from `%4s', 
sending to all clients.\n",
-                      ntohs (message->type),
-                      ntohs (message->size),
-                     GNUNET_i2s (peer));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+               "Received message of type %u and size %u from `%4s', sending to 
all clients.\n",
+               ntohs (message->type),
+               ntohs (message->size),
+               GNUNET_i2s (peer));
 #endif
       switch (ntohs (message->type))
        {
@@ -5482,9 +5474,9 @@
   ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 0);
   if (ret.rel_value > 0)
     {
-#if DEBUG_TRANSPORT
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                 "Throttling read (%llu bytes excess at %u b/s), waiting 
%llums before reading more.\n",
+#if DEBUG_TRANSPORT || 1
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                 "Throttling read (%llu bytes excess at %u b/s), waiting %llu 
ms before reading more.\n",
                  (unsigned long long) 
n->in_tracker.consumption_since_last_update__,
                  (unsigned int) n->in_tracker.available_bytes_per_s__,
                  (unsigned long long) ret.rel_value);

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2011-06-06 11:14:05 UTC (rev 
15439)
+++ gnunet/src/transport/plugin_transport_tcp.c 2011-06-06 11:26:59 UTC (rev 
15440)
@@ -2101,10 +2101,21 @@
                                (GNUNET_YES == session->inbound) ? NULL : 
session->connect_addr,
                                (GNUNET_YES == session->inbound) ? 0 : 
session->connect_alen);
   if (delay.rel_value == 0)
-    GNUNET_SERVER_receive_done (client, GNUNET_OK);
+    {
+      GNUNET_SERVER_receive_done (client, GNUNET_OK);
+    }
   else
-    session->receive_delay_task =
-      GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session);
+    {
+#if DEBUG_TCP || 1
+      GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
+                      "tcp",
+                      "Throttling receiving from `%s' for %llu ms\n",
+                      GNUNET_i2s (&session->target),
+                      (unsigned long long) delay.rel_value);
+#endif
+      session->receive_delay_task =
+       GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session);
+    }
 }
 
 
@@ -2926,18 +2937,20 @@
     }
 
   if ((bind_address != NULL) && (internal_address != NULL))
-  {
-         if (0 != strcmp(internal_address, bind_address ))
-         {
-                         GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
-                                         "tcp","Specific bind address `%s' and 
internal address `%s' must not differ, forcing internal address to bind 
address!\n", bind_address, internal_address);
-                         GNUNET_free (internal_address);
-                         internal_address = bind_address;
-                         GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
-                                         "tcp","New internal address `%s'\n", 
internal_address);
-         }
-  }
-
+    {
+      if (0 != strcmp(internal_address, bind_address ))
+       {
+         GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+                          "tcp",
+                          "Specific bind address `%s' and internal address 
`%s' must not differ, forcing internal address to bind address!\n", 
+                          bind_address, internal_address);
+         GNUNET_free (internal_address);
+         internal_address = bind_address;
+         GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+                          "tcp","New internal address `%s'\n", 
internal_address);
+       }
+    }
+  
   aport = 0;
   if ( (GNUNET_OK !=
        GNUNET_CONFIGURATION_get_value_number (env->cfg,
@@ -2963,13 +2976,13 @@
 
   use_localaddresses = GNUNET_NO;
   if (GNUNET_CONFIGURATION_have_value (env->cfg,
-                 "transport-tcp", "USE_LOCALADDR"))
+                                      "transport-tcp", "USE_LOCALADDR"))
     {
-                 use_localaddresses = GNUNET_CONFIGURATION_get_value_yesno 
(env->cfg,
-                                                                  
"transport-tcp",
-                                                              "USE_LOCALADDR");
+      use_localaddresses = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
+                                                                
"transport-tcp",
+                                                                
"USE_LOCALADDR");
     }
-
+  
   if (aport == 0)
     aport = bport;
   if (bport == 0)




reply via email to

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