gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r35308 - in gnunet/src: arm transport


From: gnunet
Subject: [GNUnet-SVN] r35308 - in gnunet/src: arm transport
Date: Sat, 28 Feb 2015 15:35:13 +0100

Author: grothoff
Date: 2015-02-28 15:35:13 +0100 (Sat, 28 Feb 2015)
New Revision: 35308

Modified:
   gnunet/src/arm/gnunet-service-arm.c
   gnunet/src/transport/plugin_transport_udp.c
Log:
-fix indentation, logging, i18n, doxygen

Modified: gnunet/src/arm/gnunet-service-arm.c
===================================================================
--- gnunet/src/arm/gnunet-service-arm.c 2015-02-28 14:12:31 UTC (rev 35307)
+++ gnunet/src/arm/gnunet-service-arm.c 2015-02-28 14:35:13 UTC (rev 35308)
@@ -1305,7 +1305,8 @@
  * @return #GNUNET_OK (continue)
  */
 static void
-setup_service (void *cls, const char *section)
+setup_service (void *cls,
+               const char *section)
 {
   struct ServiceList *sl;
   char *binary;
@@ -1353,10 +1354,13 @@
   }
   config = NULL;
   if (( (GNUNET_OK !=
-        GNUNET_CONFIGURATION_get_value_filename (cfg, section, "CONFIG",
+        GNUNET_CONFIGURATION_get_value_filename (cfg, section,
+                                                  "CONFIG",
                                                  &config)) &&
        (GNUNET_OK !=
-        GNUNET_CONFIGURATION_get_value_filename (cfg, "PATHS", "DEFAULTCONFIG",
+        GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                                  "PATHS",
+                                                  "DEFAULTCONFIG",
                                                  &config)) ) ||
       (0 != STAT (config, &sbuf)))
   {
@@ -1381,26 +1385,39 @@
   if (GNUNET_CONFIGURATION_have_value (cfg, section, "PIPECONTROL"))
     sl->pipe_control = GNUNET_CONFIGURATION_get_value_yesno (cfg, section, 
"PIPECONTROL");
 #endif
-  GNUNET_CONTAINER_DLL_insert (running_head, running_tail, sl);
-
+  GNUNET_CONTAINER_DLL_insert (running_head,
+                               running_tail,
+                               sl);
   if (GNUNET_YES ==
-      GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "FORCESTART"))
+      GNUNET_CONFIGURATION_get_value_yesno (cfg,
+                                            section,
+                                            "FORCESTART"))
   {
     sl->force_start = GNUNET_YES;
+    /* FIXME: we might like the pre-binding even for
+       _certain_ services that have force_start set,
+       otherwise interdependencies may again force
+       client's to retry connections during startup. */
     return;
   }
   else
   {
     if (GNUNET_YES !=
-        GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "AUTOSTART"))
+        GNUNET_CONFIGURATION_get_value_yesno (cfg,
+                                              section,
+                                              "AUTOSTART"))
       return;
   }
-  if (0 >= (ret = GNUNET_SERVICE_get_server_addresses (section, cfg,
-                                                      &addrs, &addr_lens)))
+  if (0 >= (ret = GNUNET_SERVICE_get_server_addresses (section,
+                                                       cfg,
+                                                      &addrs,
+                                                       &addr_lens)))
     return;
   /* this will free (or capture) addrs[i] */
   for (i = 0; i < ret; i++)
-    create_listen_socket (addrs[i], addr_lens[i], sl);
+    create_listen_socket (addrs[i],
+                          addr_lens[i],
+                          sl);
   GNUNET_free (addrs);
   GNUNET_free (addr_lens);
 }

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2015-02-28 14:12:31 UTC (rev 
35307)
+++ gnunet/src/transport/plugin_transport_udp.c 2015-02-28 14:35:13 UTC (rev 
35308)
@@ -508,7 +508,7 @@
   struct GNUNET_TRANSPORT_SessionInfo info;
 
   if (NULL == plugin->sic)
-    return;                                    
+    return;
   if (GNUNET_YES == session->in_destroy)
     return; /* already destroyed, just RC>0 left-over actions */
   memset (&info, 0, sizeof (info));
@@ -937,7 +937,7 @@
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Calling continuation for %u byte message to `%s' with result %s\n",
-       udpw->payload_size, 
+       udpw->payload_size,
        GNUNET_i2s (&udpw->session->target),
        (GNUNET_OK == result) ? "OK" : "SYSERR");
 
@@ -958,7 +958,7 @@
         udpw->cont (udpw->cont_cls,
                    &udpw->session->target,
                    result,
-                   udpw->payload_size, 
+                   udpw->payload_size,
                    udpw->msg_size);
       }
       GNUNET_STATISTICS_update (plugin->env->stats,
@@ -967,48 +967,48 @@
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
                                "# UDP, unfragmented msgs, bytes payload, sent, 
success",
-                               udpw->payload_size, 
+                               udpw->payload_size,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, unfragmented msgs, bytes overhead, 
sent, success", 
+                               "# UDP, unfragmented msgs, bytes overhead, 
sent, success",
                                overhead,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, total, bytes overhead, sent", 
-                               overhead, 
+                               "# UDP, total, bytes overhead, sent",
+                               overhead,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, total, bytes payload, sent", 
+                               "# UDP, total, bytes payload, sent",
                                udpw->payload_size,
                                GNUNET_NO);
       break;
     case UMT_MSG_FRAGMENTED_COMPLETE:
       GNUNET_assert(NULL != udpw->frag_ctx);
       if (udpw->frag_ctx->cont != NULL )
-        udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls, 
+        udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls,
                              &udpw->session->target,
-                             GNUNET_OK, 
+                             GNUNET_OK,
                              udpw->frag_ctx->payload_size,
                              udpw->frag_ctx->on_wire_size);
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, fragmented msgs, messages, sent, 
success", 
-                               1, 
+                               "# UDP, fragmented msgs, messages, sent, 
success",
+                               1,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
                                "# UDP, fragmented msgs, bytes payload, sent, 
success",
-                               udpw->payload_size, 
+                               udpw->payload_size,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, fragmented msgs, bytes overhead, sent, 
success", 
+                               "# UDP, fragmented msgs, bytes overhead, sent, 
success",
                                overhead,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, total, bytes overhead, sent", 
+                               "# UDP, total, bytes overhead, sent",
                                overhead,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, total, bytes payload, sent", 
-                               udpw->payload_size, 
+                               "# UDP, total, bytes payload, sent",
+                               udpw->payload_size,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
                                "# UDP, fragmented msgs, messages, pending",
@@ -1018,13 +1018,13 @@
     case UMT_MSG_FRAGMENTED:
       /* Fragmented message: enqueue next fragment */
       if (NULL != udpw->cont)
-        udpw->cont (udpw->cont_cls, 
-                   &udpw->session->target, 
+        udpw->cont (udpw->cont_cls,
+                   &udpw->session->target,
                    result,
-                   udpw->payload_size, 
+                   udpw->payload_size,
                    udpw->msg_size);
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, fragmented msgs, fragments, sent, 
success", 
+                               "# UDP, fragmented msgs, fragments, sent, 
success",
                                1,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1035,7 +1035,7 @@
     case UMT_MSG_ACK:
       /* No continuation */
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, ACK msgs, messages, sent, success", 
+                               "# UDP, ACK msgs, messages, sent, success",
                                1,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1044,7 +1044,7 @@
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
                                "# UDP, total, bytes overhead, sent",
-                               overhead, 
+                               overhead,
                                GNUNET_NO);
       break;
     default:
@@ -1061,7 +1061,7 @@
         udpw->cont (udpw->cont_cls,
                    &udpw->session->target,
                    result,
-                   udpw->payload_size, 
+                   udpw->payload_size,
                    overhead);
       GNUNET_STATISTICS_update (plugin->env->stats,
                                "# UDP, unfragmented msgs, messages, sent, 
failure",
@@ -1069,31 +1069,31 @@
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
                                "# UDP, unfragmented msgs, bytes payload, sent, 
failure",
-                               udpw->payload_size, 
+                               udpw->payload_size,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, unfragmented msgs, bytes overhead, 
sent, failure", 
+                               "# UDP, unfragmented msgs, bytes overhead, 
sent, failure",
                                overhead,
                                GNUNET_NO);
       break;
     case UMT_MSG_FRAGMENTED_COMPLETE:
       GNUNET_assert (NULL != udpw->frag_ctx);
       if (udpw->frag_ctx->cont != NULL)
-        udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls, 
+        udpw->frag_ctx->cont (udpw->frag_ctx->cont_cls,
                              &udpw->session->target,
-                             GNUNET_SYSERR, 
+                             GNUNET_SYSERR,
                              udpw->frag_ctx->payload_size,
                              udpw->frag_ctx->on_wire_size);
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, fragmented msgs, messages, sent, 
failure", 
-                               1, 
+                               "# UDP, fragmented msgs, messages, sent, 
failure",
+                               1,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
                                "# UDP, fragmented msgs, bytes payload, sent, 
failure",
-                               udpw->payload_size, 
+                               udpw->payload_size,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, fragmented msgs, bytes payload, sent, 
failure", 
+                               "# UDP, fragmented msgs, bytes payload, sent, 
failure",
                                overhead,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1109,7 +1109,7 @@
       GNUNET_assert (NULL != udpw->frag_ctx);
       /* Fragmented message: failed to send */
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, fragmented msgs, fragments, sent, 
failure", 
+                               "# UDP, fragmented msgs, fragments, sent, 
failure",
                                1,
                                GNUNET_NO);
       GNUNET_STATISTICS_update (plugin->env->stats,
@@ -1120,7 +1120,7 @@
     case UMT_MSG_ACK:
       /* ACK message: failed to send */
       GNUNET_STATISTICS_update (plugin->env->stats,
-                               "# UDP, ACK msgs, messages, sent, failure", 
+                               "# UDP, ACK msgs, messages, sent, failure",
                                1,
                                GNUNET_NO);
       break;
@@ -1411,7 +1411,8 @@
 
   GNUNET_assert (GNUNET_YES != s->in_destroy);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p to peer `%s' address ended\n", s,
+       "Session %p to peer `%s' address ended\n",
+       s,
        GNUNET_i2s (&s->target),
        udp_address_to_string (plugin,
                               s->address->address,
@@ -1674,15 +1675,8 @@
   const struct GNUNET_HELLO_Address *address = cctx->address;
   struct Session *s = value;
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Comparing address %s <-> %s\n",
-       udp_address_to_string (s->plugin,
-                              address->address,
-                              address->address_length),
-       udp_address_to_string (s->plugin,
-                              s->address->address,
-                              s->address->address_length));
-  if (0 == GNUNET_HELLO_address_cmp(s->address, cctx->address))
+  if (0 == GNUNET_HELLO_address_cmp (s->address,
+                                     cctx->address))
   {
     cctx->res = s;
     return GNUNET_NO;
@@ -1714,7 +1708,7 @@
         (address->address_length != sizeof (struct IPv6UdpAddress))))
   {
     LOG (GNUNET_ERROR_TYPE_WARNING,
-         _("Trying to locate session for address of unexpected length %u 
(should be %u or %u)\n"),
+         "Trying to locate session for address of unexpected length %u (should 
be %u or %u)\n",
          address->address_length,
          sizeof (struct IPv4UdpAddress),
          sizeof (struct IPv6UdpAddress));
@@ -1911,8 +1905,8 @@
                                                   (const struct sockaddr *) 
&v6,
                                                   sizeof (v6));
   }
-  return udp_plugin_create_session (cls, 
-                                   address, 
+  return udp_plugin_create_session (cls,
+                                   address,
                                    network_type);
 }
 
@@ -2492,8 +2486,7 @@
                                            GNUNET_HELLO_ADDRESS_INFO_NONE);
   s = udp_plugin_lookup_session (plugin,
                                  address);
-  if ( (NULL == s) ||
-       (NULL == s->frag_ctx) )
+  if (NULL == s)
   {
     LOG (GNUNET_ERROR_TYPE_WARNING,
          "UDP session of address %s for ACK not found\n",
@@ -2503,6 +2496,16 @@
     GNUNET_HELLO_address_free (address);
     return;
   }
+  if (NULL == s->frag_ctx)
+  {
+    LOG (GNUNET_ERROR_TYPE_WARNING,
+         "Fragmentation context of address %s for ACK not found\n",
+         udp_address_to_string (plugin,
+                                address->address,
+                                address->address_length));
+    GNUNET_HELLO_address_free (address);
+    return;
+  }
   GNUNET_HELLO_address_free (address);
 
   flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay);
@@ -2858,13 +2861,13 @@
                                   "# UDP, total, messages, sent, timeout",
                                   1,
                                   GNUNET_NO);
-        call_continuation (udpw, 
+        call_continuation (udpw,
                           GNUNET_SYSERR);
         LOG (GNUNET_ERROR_TYPE_DEBUG,
              "Fragment for message for peer `%s' with size %u timed out\n",
              GNUNET_i2s (&udpw->session->target),
             udpw->frag_ctx->payload_size);
-       
+
         GNUNET_STATISTICS_update (plugin->env->stats,
                                   "# UDP, fragmented msgs, messages, sent, 
timeout",
                                   1,
@@ -2874,7 +2877,7 @@
                                   udpw->frag_ctx->payload_size,
                                   GNUNET_NO);
         /* Remove fragmented message due to timeout */
-        fragmented_message_done (udpw->frag_ctx, 
+        fragmented_message_done (udpw->frag_ctx,
                                 GNUNET_SYSERR);
         break;
       case UMT_MSG_ACK:
@@ -2893,7 +2896,7 @@
         call_continuation (udpw,
                           GNUNET_SYSERR);
         removed = GNUNET_YES;
-        dequeue (plugin, 
+        dequeue (plugin,
                 udpw);
         GNUNET_free (udpw);
         break;
@@ -2932,9 +2935,9 @@
         /* Message is delayed, try next */
         LOG (GNUNET_ERROR_TYPE_DEBUG,
              "Message for peer `%s' (%u bytes) is delayed for %s\n",
-             GNUNET_i2s (&udpw->session->target), 
+             GNUNET_i2s (&udpw->session->target),
             udpw->payload_size,
-             GNUNET_STRINGS_relative_time_to_string (remaining, 
+             GNUNET_STRINGS_relative_time_to_string (remaining,
                                                     GNUNET_YES));
         udpw = udpw->next;
       }
@@ -3034,7 +3037,7 @@
 #endif
     a4.sin_port = u4->u4_port;
     memcpy (&a4.sin_addr,
-           &u4->ipv4_addr, 
+           &u4->ipv4_addr,
            sizeof(struct in_addr));
     a = (struct sockaddr *) &a4;
     slen = sizeof (a4);
@@ -3054,9 +3057,9 @@
   }
   else
   {
-    call_continuation (udpw, 
+    call_continuation (udpw,
                       GNUNET_OK);
-    dequeue (plugin, 
+    dequeue (plugin,
             udpw);
     notify_session_monitor (plugin,
                             udpw->session,
@@ -3073,17 +3076,17 @@
   {
     /* Failure */
     analyze_send_error (plugin,
-                       a, 
-                       slen, 
+                       a,
+                       slen,
                        errno);
-    call_continuation (udpw, 
+    call_continuation (udpw,
                       GNUNET_SYSERR);
     GNUNET_STATISTICS_update (plugin->env->stats,
-                             "# UDP, total, bytes, sent, failure", 
-                             sent, 
+                             "# UDP, total, bytes, sent, failure",
+                             sent,
                              GNUNET_NO);
     GNUNET_STATISTICS_update (plugin->env->stats,
-                             "# UDP, total, messages, sent, failure", 
+                             "# UDP, total, messages, sent, failure",
                              1,
                              GNUNET_NO);
   }




reply via email to

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