gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r35240 - gnunet/src/transport
Date: Thu, 12 Feb 2015 16:24:37 +0100

Author: grothoff
Date: 2015-02-12 16:24:37 +0100 (Thu, 12 Feb 2015)
New Revision: 35240

Modified:
   gnunet/src/transport/gnunet-service-transport_neighbours.c
Log:
-better stats for KEEPALIVEs

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2015-02-12 
15:18:37 UTC (rev 35239)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2015-02-12 
15:24:37 UTC (rev 35240)
@@ -1384,10 +1384,11 @@
 
   nonce = 0; /* 0 indicates 'not set' */
   while (0 == nonce)
-    nonce = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
+    nonce = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
+                                      UINT32_MAX);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Sending keep alive to peer `%s' with nonce %u\n",
+              "Sending KEEPALIVE to peer `%s' with nonce %u\n",
               GNUNET_i2s (&n->id),
               nonce);
   m.header.size = htons (sizeof (struct SessionKeepAliveMessage));
@@ -1455,6 +1456,10 @@
               "Received KEEPALIVE request from peer `%s' with nonce %u\n",
               GNUNET_i2s (&n->id),
               ntohl (msg_in->nonce));
+  GNUNET_STATISTICS_update (GST_stats,
+                            gettext_noop ("# KEEPALIVES received in good 
order"),
+                            1,
+                           GNUNET_NO);
 
   /* send reply to allow neighbour to measure latency */
   msg.header.size = htons (sizeof (struct SessionKeepAliveMessage));
@@ -1521,10 +1526,16 @@
   }
   if (n->primary_address.keep_alive_nonce != ntohl (msg->nonce))
   {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop ("# KEEPALIVE_RESPONSE messages 
discarded (wrong nonce)"),
-                              1,
-                              GNUNET_NO);
+    if (0 == n->primary_address.keep_alive_nonce)
+      GNUNET_STATISTICS_update (GST_stats,
+                                gettext_noop ("# KEEPALIVE_RESPONSE messages 
discarded (no nonce)"),
+                                1,
+                                GNUNET_NO);
+    else
+      GNUNET_STATISTICS_update (GST_stats,
+                                gettext_noop ("# KEEPALIVE_RESPONSE messages 
discarded (wrong nonce)"),
+                                1,
+                                GNUNET_NO);
     return;
   }
   GNUNET_STATISTICS_update (GST_stats,




reply via email to

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