more stats
authorChristian Grothoff <christian@grothoff.org>
Tue, 16 Mar 2010 08:32:22 +0000 (08:32 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 16 Mar 2010 08:32:22 +0000 (08:32 +0000)
contrib/defaults.conf
src/statistics/gnunet-statistics.c
src/topology/gnunet-daemon-topology.c
src/transport/gnunet-service-transport.c
src/transport/transport_api.c

index da25633eb05659b310bb3bbe4e6ee2e752b11607..7e194ad086ffc9c6a87a2b3b37b4f7d0b94cfb45 100644 (file)
@@ -1,5 +1,6 @@
 [PATHS]
-SERVICEHOME = /var/lib/gnunet/
+SERVICEHOME = ~/.gnunet/
+# SERVICEHOME = /var/lib/gnunet/
 # DEFAULTCONFIG = /etc/gnunet.conf
 # If 'DEFAULTCONFIG' is not defined, the current
 # configuration file is assumed to be the default,
@@ -35,7 +36,7 @@ ACCEPT_FROM = 127.0.0.1;
 ACCEPT_FROM6 = ::1;
 ALLOW_SHUTDOWN = YES
 DEFAULTSERVICES = resolver transport core topology hostlist
-#GLOBAL_POSTFIX = -l $SERVICEHOME/{}-logs
+GLOBAL_POSTFIX = -l $SERVICEHOME/{}-logs
 # GLOBAL_PREFIX =
 # USERNAME =
 # MAXBUF =
index ed0432194c545043f35d3157fe8710f5d7b43f29..4fc8d84352b953a66420d35db7718c630cf9c35b 100644 (file)
@@ -179,7 +179,7 @@ main (int argc, char *const *argv)
   return (GNUNET_OK ==
           GNUNET_PROGRAM_run (argc,
                               argv,
-                              "gnunet-statistics",
+                              "gnunet-statistics [options [value]]",
                               gettext_noop
                               ("Print statistics about GNUnet operations."),
                               options, &run, NULL)) ? ret : 1;
index b466dfbbe3e3b705f77f0ed66c48a30ea65f894a..789efcd6e835d986c31e6ab51c7124908cd70324 100644 (file)
@@ -34,7 +34,7 @@
 #include "gnunet_util_lib.h"
 
 
-#define DEBUG_TOPOLOGY GNUNET_NO
+#define DEBUG_TOPOLOGY GNUNET_YES
 
 /**
  * For how long do we blacklist a peer after a failed connection
index 6f689100247e4cadb48cb5528924c6cba85769c3..fb2a45b2318145b2786af95c42da3ad43beb6965 100644 (file)
@@ -2200,7 +2200,7 @@ rerun_validation (void *cls,
               "PING", sizeof (struct TransportPingMessage));
 #endif
   GNUNET_STATISTICS_update (stats,
-                           gettext_noop ("# PING messages sent"),
+                           gettext_noop ("# PING messages sent for re-validation"),
                            1,
                            GNUNET_NO);
   transmit_to_peer (NULL, peer_address,
@@ -2277,6 +2277,10 @@ run_validation (void *cls,
   uint16_t hello_size;
   size_t tsize;
 
+  GNUNET_STATISTICS_update (stats,
+                           gettext_noop ("# peer addresses scheduled for validation"),
+                           1,
+                           GNUNET_NO);      
   tp = find_transport (tname);
   if (tp == NULL)
     {
@@ -2285,6 +2289,10 @@ run_validation (void *cls,
                   _
                   ("Transport `%s' not loaded, will not try to validate peer address using this transport.\n"),
                   tname);
+      GNUNET_STATISTICS_update (stats,
+                               gettext_noop ("# peer addresses not validated (no applicable transport plugin available)"),
+                               1,
+                               GNUNET_NO);      
       return GNUNET_OK;
     }
   GNUNET_HELLO_get_key (chvc->hello, &pk);
@@ -2312,6 +2320,10 @@ run_validation (void *cls,
                  tname,
                  GNUNET_i2s (&id));
 #endif
+      GNUNET_STATISTICS_update (stats,
+                               gettext_noop ("# peer addresses not validated (already in progress)"),
+                               1,
+                               GNUNET_NO);      
       return GNUNET_OK;
     }
   va = GNUNET_malloc (sizeof (struct ValidationEntry) + addrlen);
@@ -2357,6 +2369,10 @@ run_validation (void *cls,
              "HELLO", hello_size,
              "PING", sizeof (struct TransportPingMessage));
 #endif
+  GNUNET_STATISTICS_update (stats,
+                           gettext_noop ("# PING messages sent for initial validation"),
+                           1,
+                           GNUNET_NO);      
   transmit_to_peer (NULL, peer_address,
                    GNUNET_SCHEDULER_PRIORITY_DEFAULT,
                    HELLO_VERIFICATION_TIMEOUT,
@@ -2460,16 +2476,33 @@ check_hello_validated (void *cls,
                      "HELLO",
                      GNUNET_i2s (&target));
 #endif
+         GNUNET_STATISTICS_update (stats,
+                                   gettext_noop ("# new HELLOs requiring full validation"),
+                                   1,
+                                   GNUNET_NO);      
          GNUNET_HELLO_iterate_addresses (chvc->hello,
                                          GNUNET_NO, 
                                          &run_validation, 
                                          chvc);
        }
+      else
+       {
+         GNUNET_STATISTICS_update (stats,
+                                   gettext_noop ("# duplicate HELLO (peer known)"),
+                                   1,
+                                   GNUNET_NO);      
+       }
       GNUNET_free (chvc);
       return;
-    }
+    } 
   if (h == NULL)
     return;
+#if DEBUG_TRANSPORT
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Peerinfo had `%s' message for peer `%4s', validating only new addresses.\n",
+             "HELLO",
+             GNUNET_i2s (peer));
+#endif
   chvc->hello_known = GNUNET_YES;
   n = find_neighbour (peer);
   if (n != NULL)
@@ -2515,7 +2548,10 @@ process_hello (struct TransportPlugin *plugin,
   if (GNUNET_SCHEDULER_get_load (sched,
                                 GNUNET_SCHEDULER_PRIORITY_BACKGROUND) > MAX_HELLO_LOAD)
     {
-      /* TODO: call to stats? */
+      GNUNET_STATISTICS_update (stats,
+                               gettext_noop ("# HELLOs ignored due to high load"),
+                               1,
+                               GNUNET_NO);      
       return GNUNET_OK;
     }
   hello = (const struct GNUNET_HELLO_Message *) message;
@@ -2527,6 +2563,16 @@ process_hello (struct TransportPlugin *plugin,
   GNUNET_CRYPTO_hash (&publicKey,
                       sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
                       &target.hashPubKey);
+  if (0 == memcmp (&my_identity,
+                  &target,
+                  sizeof (struct GNUNET_PeerIdentity)))
+    {
+      GNUNET_STATISTICS_update (stats,
+                               gettext_noop ("# HELLOs ignored for validation (is my own HELLO)"),
+                               1,
+                               GNUNET_NO);      
+      return GNUNET_OK;      
+    }
 #if DEBUG_TRANSPORT > 1
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Processing `%s' message for `%4s' of size %u\n",
@@ -2976,6 +3022,10 @@ handle_hello (void *cls,
 {
   int ret;
 
+  GNUNET_STATISTICS_update (stats,
+                           gettext_noop ("# HELLOs received from clients"),
+                           1,
+                           GNUNET_NO);      
   ret = process_hello (NULL, message);
   GNUNET_SERVER_receive_done (client, ret);
 }
index 7889cc71521829a5cf0c6d93979f637ab7d67492..469bc388ce71bdbb8da8e005cd77d24c8e710570 100644 (file)
@@ -984,6 +984,11 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle,
   struct GNUNET_MessageHeader *hc;
   uint16_t size;
 
+#if DEBUG_TRANSPORT
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Offering `%s' message to transport for validation.\n",
+             "HELLO");
+#endif
   GNUNET_break (ntohs (hello->type) == GNUNET_MESSAGE_TYPE_HELLO);
   size = ntohs (hello->size);
   GNUNET_break (size >= sizeof (struct GNUNET_MessageHeader));