removed malloc from curl_logger
[oweals/gnunet.git] / src / transport / gnunet-service-transport.c
index 8423d9cf5130210b73449fc16a2a0d5ecf9cd3a3..c117b06daa7b953c6b3aaf36526f062614ad7ecc 100644 (file)
@@ -2782,7 +2782,7 @@ setup_new_neighbour (const struct GNUNET_PeerIdentity *peer,
   if (do_hello)
     {
       GNUNET_STATISTICS_update (stats,
-                                gettext_noop ("# peerinfo iterate requests"),
+                                gettext_noop ("# peerinfo new neighbor iterate requests"),
                                 1,
                                 GNUNET_NO);
       GNUNET_STATISTICS_update (stats,
@@ -3288,7 +3288,9 @@ send_periodic_ping (void *cls,
   ping.challenge = htonl(va->challenge);
   memcpy(&ping.target, &neighbour->id, sizeof(struct GNUNET_PeerIdentity));
   if (peer_address->validated != GNUNET_YES)
-    memcpy(message_buf, our_hello, hello_size);
+    {
+      memcpy(message_buf, our_hello, hello_size);
+    }
 
   if (peer_address->addr != NULL)
     {
@@ -3325,7 +3327,12 @@ send_periodic_ping (void *cls,
 #endif
   if (peer_address->validated != GNUNET_YES)
     GNUNET_STATISTICS_update (stats,
-                              gettext_noop ("# PING+HELLO messages sent"),
+                              gettext_noop ("# PING with HELLO messages sent"),
+                              1,
+                              GNUNET_NO);
+  else
+    GNUNET_STATISTICS_update (stats,
+                              gettext_noop ("# PING without HELLO messages sent"),
                               1,
                               GNUNET_NO);
 
@@ -4124,7 +4131,7 @@ process_hello (struct TransportPlugin *plugin,
   const struct GNUNET_HELLO_Message *hello;
   struct CheckHelloValidatedContext *chvc;
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded publicKey;
-#if DEBUG_TRANSPORT_HELLO
+#if DEBUG_TRANSPORT_HELLO > 2
   char *my_id;
 #endif
   hsize = ntohs (message->size);
@@ -4196,7 +4203,7 @@ process_hello (struct TransportPlugin *plugin,
                               chvc->hello,
                               GNUNET_TIME_absolute_get ()).value > 0)
        {
-#if DEBUG_TRANSPORT_HELLO
+#if DEBUG_TRANSPORT_HELLO > 2
          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                      "Received duplicate `%s' message for `%4s'; ignored\n",
                      "HELLO",
@@ -4209,7 +4216,17 @@ process_hello (struct TransportPlugin *plugin,
                                   GNUNET_HELLO_size(hello)));
       chvc = chvc->next;
     }
-#if DEBUG_TRANSPORT_HELLO
+
+#if BREAK_TESTS
+  struct NeighbourList *temp_neighbor = find_neighbour(&target);
+  if ((NULL != temp_neighbor))
+    {
+      fprintf(stderr, "Already know peer, ignoring hello\n");
+      return GNUNET_OK;
+    }
+#endif
+
+#if DEBUG_TRANSPORT_HELLO > 2
   if (plugin != NULL)
     {
       my_id = GNUNET_strdup(GNUNET_i2s(plugin->env.my_identity));
@@ -4233,7 +4250,7 @@ process_hello (struct TransportPlugin *plugin,
   /* finally, check if HELLO was previously validated
      (continuation will then schedule actual validation) */
   GNUNET_STATISTICS_update (stats,
-                            gettext_noop ("# peerinfo iterate requests"),
+                            gettext_noop ("# peerinfo process hello iterate requests"),
                             1,
                             GNUNET_NO);
   GNUNET_STATISTICS_update (stats,
@@ -4427,8 +4444,14 @@ handle_ping(void *cls, const struct GNUNET_MessageHeader *message,
                    sizeof (struct GNUNET_PeerIdentity)))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                  _("Received `%s' message not destined for me!\n"),
-                 "PING");
+                  _("Received `%s' message from `%s' destined for `%s' which is not me!\n"),
+                 "PING",
+                 (sender_address != NULL)
+                 ? a2s (plugin->short_name,
+                        (const struct sockaddr *)sender_address,
+                        sender_address_len)
+                 : "<inbound>",
+                 GNUNET_i2s (&ping->target));
       return GNUNET_SYSERR;
     }
 #if DEBUG_PING_PONG