diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-04-10 11:08:26 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-04-10 11:08:26 +0000 |
commit | 92af7a802ec63a8d19ac53fbf38a50f88b67bdd1 (patch) | |
tree | 2b8b6a5f50b45af0196cfe76b5ccc69d40f6d6fd | |
parent | 315d8796d3bc43970905e1c141f97b9f8ddad02d (diff) | |
download | gnunet-92af7a802ec63a8d19ac53fbf38a50f88b67bdd1.tar.gz gnunet-92af7a802ec63a8d19ac53fbf38a50f88b67bdd1.zip |
cleanup
-rw-r--r-- | src/core/core.h | 2 | ||||
-rw-r--r-- | 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 @@ | |||
29 | /** | 29 | /** |
30 | * General core debugging. | 30 | * General core debugging. |
31 | */ | 31 | */ |
32 | #define DEBUG_CORE GNUNET_NO | 32 | #define DEBUG_CORE GNUNET_YES |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Debugging interaction core-clients. | 35 | * 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 @@ | |||
42 | #include "core.h" | 42 | #include "core.h" |
43 | 43 | ||
44 | 44 | ||
45 | #define DEBUG_HANDSHAKE GNUNET_NO | 45 | #define DEBUG_HANDSHAKE GNUNET_YES |
46 | 46 | ||
47 | #define DEBUG_CORE_QUOTA GNUNET_NO | 47 | #define DEBUG_CORE_QUOTA GNUNET_YES |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Receive and send buffer windows grow over time. For | 50 | * Receive and send buffer windows grow over time. For |
@@ -2079,7 +2079,7 @@ create_neighbour (const struct GNUNET_PeerIdentity *pid) | |||
2079 | n->next = neighbours; | 2079 | n->next = neighbours; |
2080 | neighbours = n; | 2080 | neighbours = n; |
2081 | neighbour_count++; | 2081 | neighbour_count++; |
2082 | GNUNET_STATISTICS_set (stats, gettext_noop ("# active neighbours"), neighbour_count, GNUNET_NO); | 2082 | GNUNET_STATISTICS_set (stats, gettext_noop ("# neighbours entries allocated"), neighbour_count, GNUNET_NO); |
2083 | n->peer = *pid; | 2083 | n->peer = *pid; |
2084 | GNUNET_CRYPTO_aes_create_session_key (&n->encrypt_key); | 2084 | GNUNET_CRYPTO_aes_create_session_key (&n->encrypt_key); |
2085 | now = GNUNET_TIME_absolute_get (); | 2085 | now = GNUNET_TIME_absolute_get (); |
@@ -2093,6 +2093,7 @@ create_neighbour (const struct GNUNET_PeerIdentity *pid) | |||
2093 | n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 2093 | n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
2094 | (uint32_t) - 1); | 2094 | (uint32_t) - 1); |
2095 | neighbour_quota_update (n, NULL); | 2095 | neighbour_quota_update (n, NULL); |
2096 | consider_free_neighbour (n); | ||
2096 | return n; | 2097 | return n; |
2097 | } | 2098 | } |
2098 | 2099 | ||
@@ -2285,7 +2286,7 @@ handle_client_request_connect (void *cls, | |||
2285 | n = find_neighbour (&cm->peer); | 2286 | n = find_neighbour (&cm->peer); |
2286 | if (n == NULL) | 2287 | if (n == NULL) |
2287 | n = create_neighbour (&cm->peer); | 2288 | n = create_neighbour (&cm->peer); |
2288 | if ( (n->is_connected) || | 2289 | if ( (GNUNET_YES == n->is_connected) || |
2289 | (n->th != NULL) ) | 2290 | (n->th != NULL) ) |
2290 | return; /* already connected, or at least trying */ | 2291 | return; /* already connected, or at least trying */ |
2291 | GNUNET_STATISTICS_update (stats, gettext_noop ("# connection requests received"), 1, GNUNET_NO); | 2292 | GNUNET_STATISTICS_update (stats, gettext_noop ("# connection requests received"), 1, GNUNET_NO); |
@@ -3551,7 +3552,7 @@ neighbour_quota_update (void *cls, | |||
3551 | { | 3552 | { |
3552 | #if DEBUG_CORE | 3553 | #if DEBUG_CORE |
3553 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3554 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3554 | "Forcing disconnect of `%4s' due to inactivity (?).\n", | 3555 | "Forcing disconnect of `%4s' due to inactivity\n", |
3555 | GNUNET_i2s (&n->peer)); | 3556 | GNUNET_i2s (&n->peer)); |
3556 | #endif | 3557 | #endif |
3557 | q_in = GNUNET_BANDWIDTH_value_init (0); /* force disconnect */ | 3558 | q_in = GNUNET_BANDWIDTH_value_init (0); /* force disconnect */ |
@@ -3569,12 +3570,13 @@ neighbour_quota_update (void *cls, | |||
3569 | if (n->bw_in.value__ != q_in.value__) | 3570 | if (n->bw_in.value__ != q_in.value__) |
3570 | { | 3571 | { |
3571 | n->bw_in = q_in; | 3572 | n->bw_in = q_in; |
3572 | GNUNET_TRANSPORT_set_quota (transport, | 3573 | if (GNUNET_YES == n->is_connected) |
3573 | &n->peer, | 3574 | GNUNET_TRANSPORT_set_quota (transport, |
3574 | n->bw_in, | 3575 | &n->peer, |
3575 | n->bw_out, | 3576 | n->bw_in, |
3576 | GNUNET_TIME_UNIT_FOREVER_REL, | 3577 | n->bw_out, |
3577 | NULL, NULL); | 3578 | GNUNET_TIME_UNIT_FOREVER_REL, |
3579 | NULL, NULL); | ||
3578 | } | 3580 | } |
3579 | schedule_quota_update (n); | 3581 | schedule_quota_update (n); |
3580 | } | 3582 | } |
@@ -3606,7 +3608,7 @@ handle_transport_notify_connect (void *cls, | |||
3606 | n = find_neighbour (peer); | 3608 | n = find_neighbour (peer); |
3607 | if (n != NULL) | 3609 | if (n != NULL) |
3608 | { | 3610 | { |
3609 | if (n->is_connected) | 3611 | if (GNUNET_YES == n->is_connected) |
3610 | { | 3612 | { |
3611 | /* duplicate connect notification!? */ | 3613 | /* duplicate connect notification!? */ |
3612 | GNUNET_break (0); | 3614 | GNUNET_break (0); |