From 92af7a802ec63a8d19ac53fbf38a50f88b67bdd1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 10 Apr 2010 11:08:26 +0000 Subject: [PATCH] cleanup --- src/core/core.h | 2 +- src/core/gnunet-service-core.c | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/core/core.h b/src/core/core.h index ea2925797..45d138140 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -29,7 +29,7 @@ /** * General core debugging. */ -#define DEBUG_CORE GNUNET_NO +#define DEBUG_CORE GNUNET_YES /** * Debugging interaction core-clients. diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 42d637bdc..22224276f 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c @@ -42,9 +42,9 @@ #include "core.h" -#define DEBUG_HANDSHAKE GNUNET_NO +#define DEBUG_HANDSHAKE GNUNET_YES -#define DEBUG_CORE_QUOTA GNUNET_NO +#define DEBUG_CORE_QUOTA GNUNET_YES /** * Receive and send buffer windows grow over time. For @@ -2079,7 +2079,7 @@ create_neighbour (const struct GNUNET_PeerIdentity *pid) n->next = neighbours; neighbours = n; neighbour_count++; - GNUNET_STATISTICS_set (stats, gettext_noop ("# active neighbours"), neighbour_count, GNUNET_NO); + GNUNET_STATISTICS_set (stats, gettext_noop ("# neighbours entries allocated"), neighbour_count, GNUNET_NO); n->peer = *pid; GNUNET_CRYPTO_aes_create_session_key (&n->encrypt_key); now = GNUNET_TIME_absolute_get (); @@ -2093,6 +2093,7 @@ create_neighbour (const struct GNUNET_PeerIdentity *pid) n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, (uint32_t) - 1); neighbour_quota_update (n, NULL); + consider_free_neighbour (n); return n; } @@ -2285,7 +2286,7 @@ handle_client_request_connect (void *cls, n = find_neighbour (&cm->peer); if (n == NULL) n = create_neighbour (&cm->peer); - if ( (n->is_connected) || + if ( (GNUNET_YES == n->is_connected) || (n->th != NULL) ) return; /* already connected, or at least trying */ GNUNET_STATISTICS_update (stats, gettext_noop ("# connection requests received"), 1, GNUNET_NO); @@ -3551,7 +3552,7 @@ neighbour_quota_update (void *cls, { #if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Forcing disconnect of `%4s' due to inactivity (?).\n", + "Forcing disconnect of `%4s' due to inactivity\n", GNUNET_i2s (&n->peer)); #endif q_in = GNUNET_BANDWIDTH_value_init (0); /* force disconnect */ @@ -3569,12 +3570,13 @@ neighbour_quota_update (void *cls, if (n->bw_in.value__ != q_in.value__) { n->bw_in = q_in; - GNUNET_TRANSPORT_set_quota (transport, - &n->peer, - n->bw_in, - n->bw_out, - GNUNET_TIME_UNIT_FOREVER_REL, - NULL, NULL); + if (GNUNET_YES == n->is_connected) + GNUNET_TRANSPORT_set_quota (transport, + &n->peer, + n->bw_in, + n->bw_out, + GNUNET_TIME_UNIT_FOREVER_REL, + NULL, NULL); } schedule_quota_update (n); } @@ -3606,7 +3608,7 @@ handle_transport_notify_connect (void *cls, n = find_neighbour (peer); if (n != NULL) { - if (n->is_connected) + if (GNUNET_YES == n->is_connected) { /* duplicate connect notification!? */ GNUNET_break (0); -- 2.25.1