aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index c4886520b..c44afa91e 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1384,10 +1384,11 @@ send_keepalive (struct NeighbourMapEntry *n)
1384 1384
1385 nonce = 0; /* 0 indicates 'not set' */ 1385 nonce = 0; /* 0 indicates 'not set' */
1386 while (0 == nonce) 1386 while (0 == nonce)
1387 nonce = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); 1387 nonce = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
1388 UINT32_MAX);
1388 1389
1389 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1390 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1390 "Sending keep alive to peer `%s' with nonce %u\n", 1391 "Sending KEEPALIVE to peer `%s' with nonce %u\n",
1391 GNUNET_i2s (&n->id), 1392 GNUNET_i2s (&n->id),
1392 nonce); 1393 nonce);
1393 m.header.size = htons (sizeof (struct SessionKeepAliveMessage)); 1394 m.header.size = htons (sizeof (struct SessionKeepAliveMessage));
@@ -1455,6 +1456,10 @@ GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour,
1455 "Received KEEPALIVE request from peer `%s' with nonce %u\n", 1456 "Received KEEPALIVE request from peer `%s' with nonce %u\n",
1456 GNUNET_i2s (&n->id), 1457 GNUNET_i2s (&n->id),
1457 ntohl (msg_in->nonce)); 1458 ntohl (msg_in->nonce));
1459 GNUNET_STATISTICS_update (GST_stats,
1460 gettext_noop ("# KEEPALIVES received in good order"),
1461 1,
1462 GNUNET_NO);
1458 1463
1459 /* send reply to allow neighbour to measure latency */ 1464 /* send reply to allow neighbour to measure latency */
1460 msg.header.size = htons (sizeof (struct SessionKeepAliveMessage)); 1465 msg.header.size = htons (sizeof (struct SessionKeepAliveMessage));
@@ -1521,10 +1526,16 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
1521 } 1526 }
1522 if (n->primary_address.keep_alive_nonce != ntohl (msg->nonce)) 1527 if (n->primary_address.keep_alive_nonce != ntohl (msg->nonce))
1523 { 1528 {
1524 GNUNET_STATISTICS_update (GST_stats, 1529 if (0 == n->primary_address.keep_alive_nonce)
1525 gettext_noop ("# KEEPALIVE_RESPONSE messages discarded (wrong nonce)"), 1530 GNUNET_STATISTICS_update (GST_stats,
1526 1, 1531 gettext_noop ("# KEEPALIVE_RESPONSE messages discarded (no nonce)"),
1527 GNUNET_NO); 1532 1,
1533 GNUNET_NO);
1534 else
1535 GNUNET_STATISTICS_update (GST_stats,
1536 gettext_noop ("# KEEPALIVE_RESPONSE messages discarded (wrong nonce)"),
1537 1,
1538 GNUNET_NO);
1528 return; 1539 return;
1529 } 1540 }
1530 GNUNET_STATISTICS_update (GST_stats, 1541 GNUNET_STATISTICS_update (GST_stats,