From 9fac6b6eefdc9144053f736fd388cb2199a97046 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 6 May 2012 01:12:57 +0000 Subject: -removing legacy ifdefs, fixing log statements --- src/ats/ats_api.c | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'src/ats/ats_api.c') diff --git a/src/ats/ats_api.c b/src/ats/ats_api.c index 82eede9dc..8499c5b22 100644 --- a/src/ats/ats_api.c +++ b/src/ats/ats_api.c @@ -34,8 +34,6 @@ #include "gnunet_ats_service.h" #include "ats_api.h" -#define DEBUG_ATS GNUNET_EXTRA_LOGGING - #define LOG(kind,...) GNUNET_log_from (kind, "ats-api", __VA_ARGS__) /** @@ -235,13 +233,10 @@ suggest_address (void *cls, const GNUNET_HashCode * key, void *value) struct GNUNET_ATS_SuggestionContext *asc = cls; struct AllocationRecord *ar = value; -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "Suggesting address for peer `%s', starting with i:%u/o:%u bytes/s\n", GNUNET_h2s (key), asc->atc->total_bps_in / 32, asc->atc->total_bps_out / 32); -#endif - /* trivial strategy: pick first available address... */ asc->cb (asc->cb_cls, &asc->target, ar->plugin_name, ar->plugin_addr, ar->plugin_addr_len, ar->session, @@ -269,10 +264,8 @@ GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *atc, { struct GNUNET_ATS_SuggestionContext *asc; -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "Looking up suggested address for peer `%s'\n", GNUNET_i2s (peer)); -#endif asc = GNUNET_malloc (sizeof (struct GNUNET_ATS_SuggestionContext)); asc->cb = cb; asc->cb_cls = cb_cls; @@ -324,9 +317,7 @@ GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg, { struct GNUNET_ATS_SchedulingHandle *atc; -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "ATS init\n"); -#endif atc = GNUNET_malloc (sizeof (struct GNUNET_ATS_SchedulingHandle)); atc->cfg = cfg; atc->alloc_cb = alloc_cb; @@ -369,9 +360,7 @@ destroy_allocation_record (void *cls, const GNUNET_HashCode * key, void *value) void GNUNET_ATS_shutdown (struct GNUNET_ATS_SchedulingHandle *atc) { -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "ATS shutdown\n"); -#endif if (GNUNET_SCHEDULER_NO_TASK != atc->ba_task) { GNUNET_SCHEDULER_cancel (atc->ba_task); @@ -435,10 +424,8 @@ update_session (void *cls, const GNUNET_HashCode * key, void *value) arnew->plugin_addr_len))))) return GNUNET_YES; /* no match */ /* records match */ -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating session for peer `%s' plugin `%s'\n", GNUNET_h2s (key), arold->plugin_name); -#endif if (arnew->session != arold->session) { arold->session = arnew->session; @@ -458,12 +445,10 @@ update_session (void *cls, const GNUNET_HashCode * key, void *value) { if (arold->ats[c_old].type == arnew->ats[c_new].type) { -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "Found type %i, old value=%i new value=%i\n", ntohl (arold->ats[c_old].type), ntohl (arold->ats[c_old].value), ntohl (arnew->ats[c_new].value)); -#endif arold->ats[c_old].value = arnew->ats[c_new].value; found = GNUNET_YES; } @@ -472,20 +457,16 @@ update_session (void *cls, const GNUNET_HashCode * key, void *value) /* Add new value */ if (found == GNUNET_NO) { -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "Added new type %i new value=%i\n", ntohl (arnew->ats[c_new].type), ntohl (arnew->ats[c_new].value)); LOG (GNUNET_ERROR_TYPE_DEBUG, "Old array size: %u\n", arold->ats_count); -#endif GNUNET_array_grow (arold->ats, arold->ats_count, arold->ats_count + 1); GNUNET_assert (arold->ats_count >= 2); arold->ats[arold->ats_count - 2].type = arnew->ats[c_new].type; arold->ats[arold->ats_count - 2].value = arnew->ats[c_new].value; arold->ats[arold->ats_count - 1].type = htonl (0); arold->ats[arold->ats_count - 1].value = htonl (0); -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "New array size: %i\n", arold->ats_count); -#endif } c_new++; } @@ -577,10 +558,7 @@ GNUNET_ATS_peer_connect (struct GNUNET_ATS_SchedulingHandle *atc, struct AllocationRecord *ar; struct UpdateSessionContext usc; -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "Connected to peer %s\n", GNUNET_i2s (peer)); -#endif - (void) GNUNET_CONTAINER_multihashmap_iterate (atc->peers, &disconnect_peer, atc); ar = create_allocation_record (plugin_name, session, plugin_addr, @@ -613,10 +591,8 @@ void GNUNET_ATS_peer_disconnect (struct GNUNET_ATS_SchedulingHandle *atc, const struct GNUNET_PeerIdentity *peer) { -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnected from peer %s\n", GNUNET_i2s (peer)); -#endif (void) GNUNET_CONTAINER_multihashmap_get_multiple (atc->peers, &peer->hashPubKey, &disconnect_peer, atc); @@ -748,10 +724,8 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *atc, struct AllocationRecord *ar; struct UpdateSessionContext usc; -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating address for peer `%s', plugin `%s'\n", GNUNET_i2s (peer), plugin_name); -#endif ar = create_allocation_record (plugin_name, session, plugin_addr, plugin_addr_len, ats, ats_count); usc.atc = atc; @@ -762,11 +736,9 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *atc, destroy_allocation_record (NULL, &peer->hashPubKey, ar); return; } -#if DEBUG_ATS LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding new address for peer `%s', plugin `%s'\n", GNUNET_i2s (peer), plugin_name); -#endif ar->connected = GNUNET_NO; GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (atc->peers, -- cgit v1.2.3