From 9fac6b6eefdc9144053f736fd388cb2199a97046 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 6 May 2012 01:12:57 +0000 Subject: [PATCH] -removing legacy ifdefs, fixing log statements --- src/arm/arm_api.c | 6 -- src/ats/ats_api.c | 28 -------- src/ats/ats_api_peer_change_preference.c | 2 - src/core/gnunet-service-core_clients.c | 6 -- src/core/gnunet-service-core_neighbours.c | 14 ---- src/core/gnunet-service-core_sessions.c | 8 --- src/datacache/datacache.c | 9 --- src/datacache/plugin_datacache_mysql.c | 1 - src/datacache/plugin_datacache_postgres.c | 44 +++++-------- src/datacache/plugin_datacache_sqlite.c | 20 +----- src/datastore/datastore.h | 1 - src/datastore/gnunet-service-datastore.c | 52 +-------------- src/dht/gnunet-service-dht_datacache.c | 2 - src/dns/dns.h | 4 +- src/dns/gnunet-service-dns.c | 4 +- src/fs/test_fs.c | 6 +- src/nat/gnunet-nat-server.c | 10 --- src/nat/nat.c | 12 ---- src/nat/nat.h | 1 - src/nat/nat_mini.c | 4 -- src/nat/nat_test.c | 14 ---- src/nse/gnunet-service-nse.c | 18 ----- src/nse/nse_api.c | 8 --- src/nse/test_nse_api.c | 11 ---- src/peerinfo/perf_peerinfo_api.c | 29 +------- src/peerinfo/test_peerinfo_api.c | 10 --- src/statistics/test_statistics_api.c | 15 ----- src/transport/gnunet-service-transport.c | 14 ---- .../gnunet-service-transport_hello.c | 14 ++-- .../gnunet-service-transport_neighbours.c | 66 ------------------- .../gnunet-service-transport_validation.c | 8 +-- src/transport/plugin_transport_http.c | 20 ------ src/transport/plugin_transport_http_server.c | 9 --- .../plugin_transport_udp_broadcasting.c | 14 ---- src/transport/transport.h | 5 -- src/transport/transport_api.c | 52 +-------------- src/util/container_heap.c | 14 ++-- src/util/gnunet-service-resolver.c | 8 +-- src/util/resolver.h | 2 - src/util/resolver_api.c | 26 ++------ src/util/test_configuration.c | 7 +- 41 files changed, 49 insertions(+), 549 deletions(-) diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index d6b65e872..1b78d3393 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c @@ -383,9 +383,6 @@ arm_service_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /* we're clearly running a test, don't daemonize */ proc = do_start_process (GNUNET_NO, NULL, loprefix, binary, "-c", config, -#if DEBUG_ARM - "-L", "DEBUG", -#endif /* no daemonization! */ lopostfix, NULL); } @@ -393,9 +390,6 @@ arm_service_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { proc = do_start_process (GNUNET_NO, NULL, loprefix, binary, "-c", config, -#if DEBUG_ARM - "-L", "DEBUG", -#endif "-d", lopostfix, NULL); } GNUNET_free (binary); 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, diff --git a/src/ats/ats_api_peer_change_preference.c b/src/ats/ats_api_peer_change_preference.c index 7290ebb7a..bff9306e4 100644 --- a/src/ats/ats_api_peer_change_preference.c +++ b/src/ats/ats_api_peer_change_preference.c @@ -251,11 +251,9 @@ GNUNET_ATS_peer_change_preference (struct GNUNET_ATS_SchedulingHandle *h, rim->reserve_inbound = htonl (amount); rim->preference_change = GNUNET_htonll (preference); rim->peer = *peer; -#if DEBUG_ATS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Queueing CHANGE PREFERENCE request for peer `%s' with RIM %u\n", GNUNET_i2s (peer), (unsigned int) pr->rim_id); -#endif GNUNET_CONTAINER_DLL_insert_tail (h->control_pending_head, h->control_pending_tail, cm); pr->pcic = info; diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c index c8e1199b7..2c603d217 100644 --- a/src/core/gnunet-service-core_clients.c +++ b/src/core/gnunet-service-core_clients.c @@ -535,11 +535,9 @@ client_tokenizer_callback (void *cls, void *client, } else { -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Delivering message of type %u to %s\n", ntohs (message->type), GNUNET_i2s (&car->target)); -#endif GSC_CLIENTS_deliver_message (&car->target, NULL, 0, message, ntohs (message->size), GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND); @@ -589,10 +587,8 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) if (client == NULL) return; -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p has disconnected from core service.\n", client); -#endif c = find_client (client); if (c == NULL) return; /* client never sent INIT */ @@ -736,10 +732,8 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, cnm->ats_count = htonl (atsi_count); a = (struct GNUNET_ATS_Information *) &cnm[1]; memcpy (a, atsi, sizeof (struct GNUNET_ATS_Information) * atsi_count); -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to client.\n", "NOTIFY_CONNECT"); -#endif cnm->peer = *neighbour; send_to_client (client, &cnm->header, GNUNET_NO); } diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c index 538f38283..97737a63a 100644 --- a/src/core/gnunet-service-core_neighbours.c +++ b/src/core/gnunet-service-core_neighbours.c @@ -145,11 +145,9 @@ free_neighbour (struct Neighbour *n) { struct NeighbourMessageEntry *m; -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Destroying neighbour entry for peer `%4s'\n", GNUNET_i2s (&n->peer)); -#endif while (NULL != (m = n->message_head)) { GNUNET_CONTAINER_DLL_remove (n->message_head, n->message_tail, m); @@ -224,13 +222,11 @@ transmit_ready (void *cls, size_t size, void *buf) GNUNET_CONTAINER_DLL_remove (n->message_head, n->message_tail, m); if (buf == NULL) { -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmission of message of type %u and size %u failed\n", (unsigned int) ntohs (((struct GNUNET_MessageHeader *) &m[1])->type), (unsigned int) m->size); -#endif GNUNET_free (m); process_queue (n); return 0; @@ -239,13 +235,11 @@ transmit_ready (void *cls, size_t size, void *buf) GNUNET_assert (size >= m->size); memcpy (cbuf, &m[1], m->size); ret = m->size; -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Copied message of type %u and size %u into transport buffer for `%4s'\n", (unsigned int) ntohs (((struct GNUNET_MessageHeader *) &m[1])->type), (unsigned int) ret, GNUNET_i2s (&n->peer)); -#endif GNUNET_free (m); process_queue (n); GNUNET_STATISTICS_update (GSC_stats, @@ -277,13 +271,11 @@ process_queue (struct Neighbour *n) GSC_SESSIONS_solicit (&n->peer); return; } -#if DEBUG_CORE > 1 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking transport for transmission of %u bytes to `%4s' in next %llu ms\n", (unsigned int) m->size, GNUNET_i2s (&n->peer), (unsigned long long) GNUNET_TIME_absolute_get_remaining (m->deadline).rel_value); -#endif n->th = GNUNET_TRANSPORT_notify_transmit_ready (transport, &n->peer, m->size, 0, GNUNET_TIME_absolute_get_remaining @@ -330,10 +322,8 @@ handle_transport_notify_connect (void *cls, GNUNET_break (0); return; } -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received connection from `%4s'.\n", GNUNET_i2s (peer)); -#endif n = GNUNET_malloc (sizeof (struct Neighbour)); n->peer = *peer; GNUNET_assert (GNUNET_OK == @@ -361,11 +351,9 @@ handle_transport_notify_disconnect (void *cls, { struct Neighbour *n; -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%4s' disconnected from us; received notification from transport.\n", GNUNET_i2s (peer)); -#endif n = find_neighbour (peer); if (n == NULL) { @@ -394,11 +382,9 @@ handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer, struct Neighbour *n; uint16_t type; -#if DEBUG_CORE > 1 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received message of type %u from `%4s', demultiplexing.\n", (unsigned int) ntohs (message->type), GNUNET_i2s (peer)); -#endif if (0 == memcmp (peer, &GSC_my_identity, sizeof (struct GNUNET_PeerIdentity))) { GNUNET_break (0); diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index 1f697cf16..7cb880053 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c @@ -176,10 +176,8 @@ GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid) session = find_session (pid); if (NULL == session) return; -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Destroying session for peer `%4s'\n", GNUNET_i2s (&session->peer)); -#endif if (GNUNET_SCHEDULER_NO_TASK != session->cork_task) { GNUNET_SCHEDULER_cancel (session->cork_task); @@ -255,10 +253,8 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer, { struct Session *session; -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating session for peer `%4s'\n", GNUNET_i2s (peer)); -#endif session = GNUNET_malloc (sizeof (struct Session)); session->tmap = GSC_TYPEMAP_create (); session->peer = *peer; @@ -341,10 +337,8 @@ GSC_SESSIONS_queue_request (struct GSC_ClientActiveRequest *car) session = find_session (&car->target); if (session == NULL) { -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Dropped client request for transmission (am disconnected)\n"); -#endif GNUNET_break (0); /* should have been rejected earlier */ GSC_CLIENTS_reject_request (car); return; @@ -355,10 +349,8 @@ GSC_SESSIONS_queue_request (struct GSC_ClientActiveRequest *car) GSC_CLIENTS_reject_request (car); return; } -#if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received client transmission request. queueing\n"); -#endif GNUNET_CONTAINER_DLL_insert (session->active_client_request_head, session->active_client_request_tail, car); try_transmission (session); diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c index 936031b91..b440af1b2 100644 --- a/src/datacache/datacache.c +++ b/src/datacache/datacache.c @@ -29,7 +29,6 @@ #include "gnunet_statistics_service.h" #include "gnunet_datacache_plugin.h" -#define DEBUG_DATACACHE GNUNET_EXTRA_LOGGING #define LOG(kind,...) GNUNET_log_from (kind, "datacache", __VA_ARGS__) @@ -108,10 +107,8 @@ env_delete_notify (void *cls, const GNUNET_HashCode * key, size_t size) { struct GNUNET_DATACACHE_Handle *h = cls; -#if DEBUG_DATACACHE LOG (GNUNET_ERROR_TYPE_DEBUG, "Content under key `%s' discarded\n", GNUNET_h2s (key)); -#endif GNUNET_assert (h->utilization >= size); h->utilization -= size; GNUNET_CONTAINER_bloomfilter_remove (h->filter, key); @@ -248,10 +245,8 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h, GNUNET_break (0); return GNUNET_SYSERR; } -#if DEBUG_DATACACHE LOG (GNUNET_ERROR_TYPE_DEBUG, "Stored data under key `%s' in cache\n", GNUNET_h2s (key)); -#endif GNUNET_STATISTICS_update (h->stats, gettext_noop ("# bytes stored"), size, GNUNET_NO); GNUNET_CONTAINER_bloomfilter_add (h->filter, key); @@ -280,20 +275,16 @@ GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h, { GNUNET_STATISTICS_update (h->stats, gettext_noop ("# requests received"), 1, GNUNET_NO); -#if DEBUG_DATACACHE LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing request for key `%s'\n", GNUNET_h2s (key)); -#endif if (GNUNET_OK != GNUNET_CONTAINER_bloomfilter_test (h->filter, key)) { GNUNET_STATISTICS_update (h->stats, gettext_noop ("# requests filtered by bloom filter"), 1, GNUNET_NO); -#if DEBUG_DATACACHE LOG (GNUNET_ERROR_TYPE_DEBUG, "Bloomfilter filters request for key `%s'\n", GNUNET_h2s (key)); -#endif return 0; /* can not be present */ } return h->api->get (h->api->cls, key, type, iter, iter_cls); diff --git a/src/datacache/plugin_datacache_mysql.c b/src/datacache/plugin_datacache_mysql.c index d618e07b8..810342908 100644 --- a/src/datacache/plugin_datacache_mysql.c +++ b/src/datacache/plugin_datacache_mysql.c @@ -83,7 +83,6 @@ #include "gnunet_mysql_lib.h" #include -#define DEBUG_DATACACHE_MYSQL GNUNET_EXTRA_LOGGING /** * Estimate of the per-entry overhead (including indices). diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c index cd4286b92..b40f1fd04 100644 --- a/src/datacache/plugin_datacache_postgres.c +++ b/src/datacache/plugin_datacache_postgres.c @@ -29,7 +29,7 @@ #include "gnunet_datacache_plugin.h" #include -#define DEBUG_POSTGRES GNUNET_EXTRA_LOGGING +#define LOG(kind,...) GNUNET_log_from (kind, "datacache-postgres", __VA_ARGS__) /** * Per-entry overhead estimate @@ -236,20 +236,16 @@ postgres_plugin_get (void *cls, const GNUNET_HashCode * key, GNUNET_POSTGRES_check_result (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", (type == 0) ? "getk" : "getkt")) { -#if DEBUG_POSTGRES - GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datacache-postgres", - "Ending iteration (postgres error)\n"); -#endif + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Ending iteration (postgres error)\n"); return 0; } if (0 == (cnt = PQntuples (res))) { /* no result */ -#if DEBUG_POSTGRES - GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datacache-postgres", - "Ending iteration (no more results)\n"); -#endif + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Ending iteration (no more results)\n"); PQclear (res); return 0; } @@ -271,19 +267,15 @@ postgres_plugin_get (void *cls, const GNUNET_HashCode * key, GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, i, 0)); type = ntohl (*(uint32_t *) PQgetvalue (res, i, 1)); size = PQgetlength (res, i, 2); -#if DEBUG_POSTGRES - GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datacache-postgres", - "Found result of size %u bytes and type %u in database\n", - (unsigned int) size, (unsigned int) type); -#endif + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Found result of size %u bytes and type %u in database\n", + (unsigned int) size, (unsigned int) type); if (GNUNET_SYSERR == iter (iter_cls, expiration_time, key, size, PQgetvalue (res, i, 2), (enum GNUNET_BLOCK_Type) type)) { -#if DEBUG_POSTGRES - GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datacache-postgres", - "Ending iteration (client error)\n"); -#endif + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Ending iteration (client error)\n"); PQclear (res); return cnt; } @@ -313,19 +305,15 @@ postgres_plugin_del (void *cls) if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "getm")) { -#if DEBUG_POSTGRES - GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datacache-postgres", - "Ending iteration (postgres error)\n"); -#endif + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Ending iteration (postgres error)\n"); return 0; } if (0 == PQntuples (res)) { /* no result */ -#if DEBUG_POSTGRES - GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datacache-postgres", - "Ending iteration (no more results)\n"); -#endif + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Ending iteration (no more results)\n"); PQclear (res); return GNUNET_SYSERR; } @@ -375,8 +363,8 @@ libgnunet_plugin_datacache_postgres_init (void *cls) api->get = &postgres_plugin_get; api->put = &postgres_plugin_put; api->del = &postgres_plugin_del; - GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "datacache-postgres", - _("Postgres datacache running\n")); + LOG (GNUNET_ERROR_TYPE_INFO, + _("Postgres datacache running\n")); return api; } diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c index f852d3b06..db27de3e2 100644 --- a/src/datacache/plugin_datacache_sqlite.c +++ b/src/datacache/plugin_datacache_sqlite.c @@ -28,8 +28,6 @@ #include "gnunet_datacache_plugin.h" #include -#define DEBUG_DATACACHE_SQLITE GNUNET_EXTRA_LOGGING - #define LOG(kind,...) GNUNET_log_from (kind, "datacache-sqlite", __VA_ARGS__) #define LOG_STRERROR_FILE(kind,op,fn) GNUNET_log_from_strerror_file (kind, "datacache-sqlite", op, fn) @@ -108,13 +106,11 @@ sqlite_plugin_put (void *cls, const GNUNET_HashCode * key, size_t size, sqlite3_stmt *stmt; int64_t dval; -#if DEBUG_DATACACHE_SQLITE LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' of %u bytes with key `%4s' and expiration %llums\n", "PUT", (unsigned int) size, GNUNET_h2s (key), (unsigned long long) GNUNET_TIME_absolute_get_remaining (discard_time).rel_value); -#endif dval = (int64_t) discard_time.abs_value; if (dval < 0) dval = INT64_MAX; @@ -182,10 +178,8 @@ sqlite_plugin_get (void *cls, const GNUNET_HashCode * key, int64_t ntime; now = GNUNET_TIME_absolute_get (); -#if DEBUG_DATACACHE_SQLITE LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' for key `%4s'\n", "GET", GNUNET_h2s (key)); -#endif if (sq_prepare (plugin->dbh, "SELECT count(*) FROM ds090 WHERE key=? AND type=? AND expire >= ?", @@ -214,23 +208,19 @@ sqlite_plugin_get (void *cls, const GNUNET_HashCode * key, LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite_step"); sqlite3_finalize (stmt); -#if DEBUG_DATACACHE_SQLITE LOG (GNUNET_ERROR_TYPE_DEBUG, "No content found when processing `%s' for key `%4s'\n", "GET", GNUNET_h2s (key)); -#endif return 0; } total = sqlite3_column_int (stmt, 0); sqlite3_finalize (stmt); if ((total == 0) || (iter == NULL)) { -#if DEBUG_DATACACHE_SQLITE if (0 == total) LOG (GNUNET_ERROR_TYPE_DEBUG, "No content found when processing `%s' for key `%4s'\n", "GET", GNUNET_h2s (key)); -#endif return total; } @@ -268,11 +258,9 @@ sqlite_plugin_get (void *cls, const GNUNET_HashCode * key, if (ntime == INT64_MAX) exp = GNUNET_TIME_UNIT_FOREVER_ABS; cnt++; -#if DEBUG_DATACACHE_SQLITE LOG (GNUNET_ERROR_TYPE_DEBUG, "Found %u-byte result when processing `%s' for key `%4s'\n", (unsigned int) size, "GET", GNUNET_h2s (key)); -#endif if (GNUNET_OK != iter (iter_cls, exp, key, size, dat, type)) { sqlite3_finalize (stmt); @@ -301,9 +289,7 @@ sqlite_plugin_del (void *cls) sqlite3_stmt *dstmt; GNUNET_HashCode hc; -#if DEBUG_DATACACHE_SQLITE LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s'\n", "DEL"); -#endif stmt = NULL; dstmt = NULL; if (sq_prepare @@ -458,15 +444,11 @@ libgnunet_plugin_datacache_sqlite_done (void *cls) stmt = sqlite3_next_stmt (plugin->dbh, NULL); while (stmt != NULL) { -#if DEBUG_SQLITE LOG (GNUNET_ERROR_TYPE_DEBUG, "Closing statement %p\n", stmt); -#endif result = sqlite3_finalize (stmt); -#if DEBUG_SQLITE if (result != SQLITE_OK) - LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to close statement %p: %d\n", + LOG (GNUNET_ERROR_TYPE_WARNING, _("Failed to close statement %p: %d\n"), stmt, result); -#endif stmt = sqlite3_next_stmt (plugin->dbh, NULL); } result = sqlite3_close (plugin->dbh); diff --git a/src/datastore/datastore.h b/src/datastore/datastore.h index c8b2c722b..87ceb0134 100644 --- a/src/datastore/datastore.h +++ b/src/datastore/datastore.h @@ -27,7 +27,6 @@ #ifndef DATASTORE_H #define DATASTORE_H -#define DEBUG_DATASTORE GNUNET_EXTRA_LOGGING #include "gnunet_util_lib.h" diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index 863cd3902..49b9db859 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c @@ -341,12 +341,10 @@ expired_processor (void *cls, const GNUNET_HashCode * key, uint32_t size, &delete_expired, NULL); return GNUNET_SYSERR; } -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting content `%s' of type %u that expired %llu ms ago\n", GNUNET_h2s (key), type, (unsigned long long) (now.abs_value - expiration.abs_value)); -#endif min_expiration = now; GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes expired"), size, GNUNET_YES); @@ -405,7 +403,6 @@ quota_processor (void *cls, const GNUNET_HashCode * key, uint32_t size, if (NULL == key) return GNUNET_SYSERR; -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting %llu bytes of low-priority (%u) content `%s' of type %u at %llu ms prior to expiration (still trying to free another %llu bytes)\n", (unsigned long long) (size + GNUNET_DATASTORE_ENTRY_OVERHEAD), @@ -413,7 +410,6 @@ quota_processor (void *cls, const GNUNET_HashCode * key, uint32_t size, GNUNET_h2s (key), type, (unsigned long long) GNUNET_TIME_absolute_get_remaining (expiration).rel_value, *need); -#endif if (size + GNUNET_DATASTORE_ENTRY_OVERHEAD > *need) *need = 0; else @@ -447,10 +443,8 @@ manage_space (unsigned long long need) { unsigned long long last; -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asked to free up %llu bytes of cache space\n", need); -#endif last = 0; while ((need > 0) && (last != need)) { @@ -513,10 +507,8 @@ transmit (struct GNUNET_SERVER_Client *client, struct GNUNET_MessageHeader *msg) if (GNUNET_YES == cleaning_done) { -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "Shutdown in progress, aborting transmission.\n"); -#endif + _("Shutdown in progress, aborting transmission.\n")); GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); GNUNET_free (msg); return; @@ -554,11 +546,9 @@ transmit_status (struct GNUNET_SERVER_Client *client, int code, const char *msg) struct StatusMessage *sm; size_t slen; -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' message with value %d and message `%s'\n", "STATUS", code, msg != NULL ? msg : "(none)"); -#endif slen = (msg == NULL) ? 0 : strlen (msg) + 1; sm = GNUNET_malloc (sizeof (struct StatusMessage) + slen); sm->header.size = htons (sizeof (struct StatusMessage) + slen); @@ -603,10 +593,8 @@ transmit_item (void *cls, const GNUNET_HashCode * key, uint32_t size, if (key == NULL) { /* transmit 'DATA_END' */ -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' message\n", "DATA_END"); -#endif end = GNUNET_malloc (sizeof (struct GNUNET_MessageHeader)); end->size = htons (sizeof (struct GNUNET_MessageHeader)); end->type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_DATA_END); @@ -630,13 +618,11 @@ transmit_item (void *cls, const GNUNET_HashCode * key, uint32_t size, dm->uid = GNUNET_htonll (uid); dm->key = *key; memcpy (&dm[1], data, size); -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' message for `%s' of type %u with expiration %llu (now: %llu)\n", "DATA", GNUNET_h2s (key), type, (unsigned long long) expiration.abs_value, (unsigned long long) GNUNET_TIME_absolute_get ().abs_value); -#endif GNUNET_STATISTICS_update (stats, gettext_noop ("# results found"), 1, GNUNET_NO); transmit (client, &dm->header); @@ -668,9 +654,7 @@ handle_reserve (void *cls, struct GNUNET_SERVER_Client *client, uint64_t amount; uint32_t entries; -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' request\n", "RESERVE"); -#endif amount = GNUNET_ntohll (msg->amount); entries = ntohl (msg->entries); used = payload + reserved; @@ -742,10 +726,8 @@ handle_release_reserve (void *cls, struct GNUNET_SERVER_Client *client, int rid = ntohl (msg->rid); unsigned long long rem; -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' request\n", "RELEASE_RESERVE"); -#endif next = reservations; prev = NULL; while (NULL != (pos = next)) @@ -764,11 +746,9 @@ handle_release_reserve (void *cls, struct GNUNET_SERVER_Client *client, reserved -= rem; GNUNET_STATISTICS_set (stats, gettext_noop ("# reserved"), reserved, GNUNET_NO); -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Returning %llu remaining reserved bytes to storage pool\n", rem); -#endif GNUNET_free (pos); transmit_status (client, GNUNET_OK, NULL); return; @@ -854,11 +834,9 @@ execute_put (struct GNUNET_SERVER_Client *client, const struct DataMessage *dm) GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes stored"), size, GNUNET_YES); GNUNET_CONTAINER_bloomfilter_add (filter, &dm->key); -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully stored %u bytes of type %u under key `%s'\n", size, ntohl (dm->type), GNUNET_h2s (&dm->key)); -#endif } transmit_status (client, ret, msg); GNUNET_free_non_null (msg); @@ -914,10 +892,8 @@ check_present (void *cls, const GNUNET_HashCode * key, uint32_t size, (0 == memcmp (&dm[1], data, size)))) { -#if DEBUG_MYSQL GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result already present in datastore\n"); -#endif /* FIXME: change API to allow increasing 'replication' counter */ if ((ntohl (dm->priority) > 0) || (GNUNET_TIME_absolute_ntoh (dm->expiration).abs_value > @@ -963,11 +939,9 @@ handle_put (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' request for `%s' of type %u\n", "PUT", GNUNET_h2s (&dm->key), ntohl (dm->type)); -#endif rid = ntohl (dm->rid); size = ntohl (dm->size); if (rid > 0) @@ -1026,11 +1000,9 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, return; } msg = (const struct GetMessage *) message; -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' request for `%s' of type %u\n", "GET", GNUNET_h2s (&msg->key), ntohl (msg->type)); -#endif GNUNET_STATISTICS_update (stats, gettext_noop ("# GET requests received"), 1, GNUNET_NO); GNUNET_SERVER_client_keep (client); @@ -1038,11 +1010,9 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (filter, &msg->key))) { /* don't bother database... */ -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Empty result set for `%s' request for `%s' (bloomfilter).\n", "GET", GNUNET_h2s (&msg->key)); -#endif GNUNET_STATISTICS_update (stats, gettext_noop ("# requests filtered by bloomfilter"), 1, @@ -1077,10 +1047,8 @@ handle_update (void *cls, struct GNUNET_SERVER_Client *client, 1, GNUNET_NO); msg = (const struct UpdateMessage *) message; emsg = NULL; -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' request for %llu\n", "UPDATE", (unsigned long long) GNUNET_ntohll (msg->uid)); -#endif ret = plugin->api->update (plugin->api->cls, GNUNET_ntohll (msg->uid), (int32_t) ntohl (msg->priority), @@ -1101,10 +1069,8 @@ static void handle_get_replication (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' request\n", "GET_REPLICATION"); -#endif GNUNET_STATISTICS_update (stats, gettext_noop ("# GET REPLICATION requests received"), 1, @@ -1136,10 +1102,8 @@ handle_get_zero_anonymity (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' request\n", "GET_ZERO_ANONYMITY"); -#endif GNUNET_STATISTICS_update (stats, gettext_noop ("# GET ZERO ANONYMITY requests received"), 1, @@ -1165,19 +1129,15 @@ remove_callback (void *cls, const GNUNET_HashCode * key, uint32_t size, if (key == NULL) { -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No further matches for `%s' request.\n", "REMOVE"); -#endif transmit_status (client, GNUNET_NO, _("Content not found")); GNUNET_SERVER_client_drop (client); return GNUNET_OK; /* last item */ } -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Item %llu matches `%s' request for key `%s' and type %u.\n", (unsigned long long) uid, "REMOVE", GNUNET_h2s (key), type); -#endif GNUNET_STATISTICS_update (stats, gettext_noop ("# bytes removed (explicit request)"), size, GNUNET_YES); @@ -1208,11 +1168,9 @@ handle_remove (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' request for `%s' of type %u\n", "REMOVE", GNUNET_h2s (&dm->key), ntohl (dm->type)); -#endif GNUNET_STATISTICS_update (stats, gettext_noop ("# REMOVE requests received"), 1, GNUNET_NO); GNUNET_SERVER_client_keep (client); @@ -1234,9 +1192,7 @@ static void handle_drop (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_MessageHeader *message) { -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s' request\n", "DROP"); -#endif do_drop = GNUNET_YES; GNUNET_SERVER_receive_done (client, GNUNET_OK); } @@ -1287,11 +1243,9 @@ process_stat_in (void *cls, const char *subsystem, const char *name, GNUNET_assert (stats_worked == GNUNET_NO); stats_worked = GNUNET_YES; payload += value; -#if DEBUG_SQLITE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Notification from statistics about existing payload (%llu), new payload is %llu\n", - abs_value, payload); -#endif + value, payload); return GNUNET_OK; } @@ -1348,10 +1302,8 @@ load_plugin () static void unload_plugin (struct DatastorePlugin *plug) { -#if DEBUG_DATASTORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Datastore service is unloading plugin...\n"); -#endif GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api)); GNUNET_free (plug->lib_name); GNUNET_free (plug->short_name); diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c index 82cd06727..4d1dd6f68 100644 --- a/src/dht/gnunet-service-dht_datacache.c +++ b/src/dht/gnunet-service-dht_datacache.c @@ -193,11 +193,9 @@ datacache_get_iterator (void *cls, struct GNUNET_TIME_Absolute exp, GNUNET_BLOCK_evaluate (GDS_block_context, type, key, ctx->reply_bf, ctx->reply_bf_mutator, ctx->xquery, ctx->xquery_size, rdata, rdata_size); -#if DEBUG_DHT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found reply for query %s in datacache, evaluation result is %d\n", GNUNET_h2s (key), (int) eval); -#endif ctx->eval = eval; switch (eval) { diff --git a/src/dns/dns.h b/src/dns/dns.h index 2b0ad0376..ee95d9c73 100644 --- a/src/dns/dns.h +++ b/src/dns/dns.h @@ -23,8 +23,8 @@ * @brief IPC messages between DNS API and DNS service * @author Christian Grothoff */ -#ifndef DNS_NEW_H -#define DNS_NEW_H +#ifndef DNS_H +#define DNS_H GNUNET_NETWORK_STRUCT_BEGIN diff --git a/src/dns/gnunet-service-dns.c b/src/dns/gnunet-service-dns.c index b4d64e0d9..3a8aa054e 100644 --- a/src/dns/gnunet-service-dns.c +++ b/src/dns/gnunet-service-dns.c @@ -1196,10 +1196,8 @@ handle_client_response (void *cls GNUNET_UNUSED, return; } GNUNET_free_non_null (rr->payload); -#if DEBUG_DNS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - _("Changing DNS reply according to client specifications\n")); -#endif + "Changing DNS reply according to client specifications\n"); rr->payload = GNUNET_malloc (msize); rr->payload_length = msize; memcpy (rr->payload, &resp[1], msize); diff --git a/src/fs/test_fs.c b/src/fs/test_fs.c index 9aee89e85..5ec5ab053 100644 --- a/src/fs/test_fs.c +++ b/src/fs/test_fs.c @@ -19,8 +19,8 @@ */ /** - * @file applications/fs/fsui/basic_fsui_test.c - * @brief testcase for fsui (upload-search-download-unindex) + * @file fs/test_fs.c + * @brief testcase for FS (upload-search-download-unindex) * @author Christian Grothoff */ @@ -248,4 +248,4 @@ FAILURE: return (ok == GNUNET_YES) ? 0 : 1; } -/* end of basic_fsui_test.c */ +/* end of test_fs.c */ diff --git a/src/nat/gnunet-nat-server.c b/src/nat/gnunet-nat-server.c index 0336ecc9d..9b6846cf0 100644 --- a/src/nat/gnunet-nat-server.c +++ b/src/nat/gnunet-nat-server.c @@ -55,11 +55,9 @@ try_anat (uint32_t dst_ipv4, uint16_t dport, int is_tcp) struct GNUNET_NAT_Handle *h; struct sockaddr_in sa; -#if DEBUG_NAT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking for connection reversal with %x and code %u\n", (unsigned int) dst_ipv4, (unsigned int) dport); -#endif h = GNUNET_NAT_register (cfg, is_tcp, dport, 0, NULL, NULL, NULL, NULL, NULL); memset (&sa, 0, sizeof (sa)); sa.sin_family = AF_INET; @@ -107,9 +105,7 @@ tcp_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (-1 == GNUNET_NETWORK_socket_send (ctx->s, &ctx->data, sizeof (ctx->data))) { -#if DEBUG_NAT GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "send"); -#endif } GNUNET_NETWORK_socket_shutdown (ctx->s, SHUT_RDWR); } @@ -146,10 +142,8 @@ try_send_tcp (uint32_t dst_ipv4, uint16_t dport, uint16_t data) #endif sa.sin_addr.s_addr = dst_ipv4; sa.sin_port = htons (dport); -#if DEBUG_NAT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TCP message to `%s'\n", GNUNET_a2s ((struct sockaddr *) &sa, sizeof (sa))); -#endif if ((GNUNET_OK != GNUNET_NETWORK_socket_connect (s, (const struct sockaddr *) &sa, sizeof (sa))) && (errno != EINPROGRESS)) @@ -192,10 +186,8 @@ try_send_udp (uint32_t dst_ipv4, uint16_t dport, uint16_t data) #endif sa.sin_addr.s_addr = dst_ipv4; sa.sin_port = htons (dport); -#if DEBUG_NAT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending UDP packet to `%s'\n", GNUNET_a2s ((struct sockaddr *) &sa, sizeof (sa))); -#endif if (-1 == GNUNET_NETWORK_socket_sendto (s, &data, sizeof (data), (const struct sockaddr *) &sa, sizeof (sa))) @@ -219,9 +211,7 @@ test (void *cls, struct GNUNET_SERVER_Client *client, const struct GNUNET_NAT_TestMessage *tm; uint16_t dport; -#if DEBUG_NAT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received test request\n"); -#endif tm = (const struct GNUNET_NAT_TestMessage *) msg; dport = ntohs (tm->dport); if (0 == dport) diff --git a/src/nat/nat.c b/src/nat/nat.c index 53301ebb1..1b6556cbf 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c @@ -422,10 +422,8 @@ add_to_address_list_as_is (struct GNUNET_NAT_Handle *h, lal->addrlen = arg_size; lal->source = src; GNUNET_CONTAINER_DLL_insert (h->lal_head, h->lal_tail, lal); -#if DEBUG_NAT LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address `%s' from source %d\n", GNUNET_a2s (arg, arg_size), src); -#endif if (NULL != h->address_callback) h->address_callback (h->callback_cls, GNUNET_YES, arg, arg_size); } @@ -750,10 +748,8 @@ nat_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_DISK_file_read (h->server_stdout_handle, mybuf, sizeof (mybuf)); if (bytes < 1) { -#if DEBUG_NAT LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished reading from server stdout with code: %d\n", bytes); -#endif if (0 != GNUNET_OS_process_kill (h->server_proc, SIGTERM)) GNUNET_log_from_strerror (GNUNET_ERROR_TYPE_WARNING, "nat", "kill"); GNUNET_OS_process_wait (h->server_proc); @@ -809,10 +805,8 @@ nat_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) return; } sin_addr.sin_port = htons ((uint16_t) port); -#if DEBUG_NAT LOG (GNUNET_ERROR_TYPE_DEBUG, "gnunet-helper-nat-server read: %s:%d\n", mybuf, port); -#endif h->reversal_callback (h->callback_cls, (const struct sockaddr *) &sin_addr, sizeof (sin_addr)); h->server_read_task = @@ -837,10 +831,8 @@ start_gnunet_nat_server (struct GNUNET_NAT_Handle *h) (h->server_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES)))) { -#if DEBUG_NAT LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting `%s' at `%s'\n", "gnunet-helper-nat-server", h->internal_address); -#endif /* Start the server process */ h->server_proc = GNUNET_OS_start_process (GNUNET_NO, NULL, h->server_stdout, @@ -1079,11 +1071,9 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, int is_tcp, struct in_addr in_addr; unsigned int i; -#if DEBUG_NAT LOG (GNUNET_ERROR_TYPE_DEBUG, "Registered with NAT service at port %u with %u IP bound local addresses\n", (unsigned int) adv_port, num_addrs); -#endif h = GNUNET_malloc (sizeof (struct GNUNET_NAT_Handle)); h->server_retry_delay = GNUNET_TIME_UNIT_SECONDS; h->cfg = cfg; @@ -1338,11 +1328,9 @@ GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, return GNUNET_SYSERR; } GNUNET_snprintf (port_as_string, sizeof (port_as_string), "%d", h->adv_port); -#if DEBUG_NAT LOG (GNUNET_ERROR_TYPE_DEBUG, _("Running gnunet-helper-nat-client %s %s %u\n"), h->internal_address, inet4, (unsigned int) h->adv_port); -#endif proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "gnunet-helper-nat-client", diff --git a/src/nat/nat.h b/src/nat/nat.h index efab3a7a7..a0ef46593 100644 --- a/src/nat/nat.h +++ b/src/nat/nat.h @@ -28,7 +28,6 @@ #define NAT_H #include "gnunet_util_lib.h" -#define DEBUG_NAT GNUNET_EXTRA_LOGGING GNUNET_NETWORK_STRUCT_BEGIN diff --git a/src/nat/nat_mini.c b/src/nat/nat_mini.c index 84cc84186..864a7f04e 100644 --- a/src/nat/nat_mini.c +++ b/src/nat/nat_mini.c @@ -524,9 +524,7 @@ process_unmap_output (void *cls, const char *line) if (NULL == line) { -#if DEBUG_NAT LOG (GNUNET_ERROR_TYPE_DEBUG, "UPnP unmap done\n"); -#endif GNUNET_OS_command_stop (mini->unmap_cmd); mini->unmap_cmd = NULL; GNUNET_free (mini); @@ -577,10 +575,8 @@ GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini) * often are the same, but it might... */ GNUNET_snprintf (pstr, sizeof (pstr), "%u", (unsigned int) ntohs (mini->current_addr.sin_port)); -#if DEBUG_NAT LOG (GNUNET_ERROR_TYPE_DEBUG, "Unmapping port %u with UPnP\n", ntohs (mini->current_addr.sin_port)); -#endif mini->unmap_cmd = GNUNET_OS_command_run (&process_unmap_output, mini, UNMAP_TIMEOUT, "upnpc", "upnpc", "-d", pstr, diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c index 98ce82e73..5704d3484 100644 --- a/src/nat/nat_test.c +++ b/src/nat/nat_test.c @@ -180,10 +180,8 @@ reversal_cb (void *cls, const struct sockaddr *addr, socklen_t addrlen) sa = (const struct sockaddr_in *) addr; if (h->data != sa->sin_port) { -#if DEBUG_NAT LOG (GNUNET_ERROR_TYPE_DEBUG, "Received connection reversal request for wrong port\n"); -#endif return; /* wrong port */ } /* report success */ @@ -214,17 +212,13 @@ do_udp_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (data == tst->data) tst->report (tst->report_cls, GNUNET_OK); -#if DEBUG_NAT else LOG (GNUNET_ERROR_TYPE_DEBUG, "Received data mismatches expected value\n"); -#endif } -#if DEBUG_NAT else LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to receive data from inbound connection\n"); -#endif } @@ -252,17 +246,13 @@ do_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { if (data == tst->data) tst->report (tst->report_cls, GNUNET_OK); -#if DEBUG_NAT else LOG (GNUNET_ERROR_TYPE_DEBUG, "Received data mismatches expected value\n"); -#endif } -#if DEBUG_NAT else LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to receive data from inbound connection\n"); -#endif GNUNET_NETWORK_socket_close (na->sock); GNUNET_free (na); } @@ -294,10 +284,8 @@ do_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_log_strerror (GNUNET_ERROR_TYPE_INFO, "accept"); return; /* odd error */ } -#if DEBUG_NAT LOG (GNUNET_ERROR_TYPE_DEBUG, "Got an inbound connection, waiting for data\n"); -#endif wl = GNUNET_malloc (sizeof (struct NatActivity)); wl->sock = s; wl->h = tst; @@ -331,10 +319,8 @@ addr_cb (void *cls, int add_remove, const struct sockaddr *addr, return; if (addrlen != sizeof (struct sockaddr_in)) return; /* ignore IPv6 here */ -#if DEBUG_NAT LOG (GNUNET_ERROR_TYPE_DEBUG, "Asking gnunet-nat-server to connect to `%s'\n", GNUNET_a2s (addr, addrlen)); -#endif sa = (const struct sockaddr_in *) addr; msg.header.size = htons (sizeof (struct GNUNET_NAT_TestMessage)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_NAT_TEST); diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index 8aff436cb..8373b621c 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -410,9 +410,7 @@ handle_start_message (void *cls, struct GNUNET_SERVER_Client *client, { struct GNUNET_NSE_ClientMessage em; -#if DEBUG_NSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n"); -#endif GNUNET_SERVER_notification_context_add (nc, client); setup_estimate_message (&em); GNUNET_SERVER_notification_context_unicast (nc, client, &em.header, @@ -457,11 +455,9 @@ get_delay_randomization (uint32_t matching_bits) d = get_matching_bits_delay (matching_bits); i = (uint32_t) (d / (double) (hop_count_max + 1)); -#if DEBUG_NSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Randomizing flood using latencies up to %u ms\n", (unsigned int) i); -#endif ret.rel_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, i + 1); return ret; #else @@ -514,11 +510,9 @@ get_transmit_delay (int round_offset) #else ret = GNUNET_TIME_UNIT_ZERO; #endif -#if DEBUG_NSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting previous round behind schedule in %llu ms\n", (unsigned long long) ret.rel_value); -#endif return ret; case 0: /* current round is based on best-known matching_bits */ @@ -527,13 +521,11 @@ get_transmit_delay (int round_offset) dist_delay = get_matching_bits_delay (matching_bits); dist_delay += get_delay_randomization (matching_bits).rel_value; ret.rel_value = (uint64_t) dist_delay; -#if DEBUG_NSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "For round %llu, delay for %u matching bits is %llu ms\n", (unsigned long long) current_timestamp.abs_value, (unsigned int) matching_bits, (unsigned long long) ret.rel_value); -#endif /* now consider round start time and add delay to it */ tgt = GNUNET_TIME_absolute_add (current_timestamp, ret); return GNUNET_TIME_absolute_get_remaining (tgt); @@ -599,7 +591,6 @@ transmit_ready (void *cls, size_t size, void *buf) 1, GNUNET_NO); return 0; } -#if DEBUG_NSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "In round %llu, sending to `%s' estimate with %u bits\n", (unsigned long long) @@ -607,7 +598,6 @@ transmit_ready (void *cls, size_t size, void *buf) timestamp).abs_value, GNUNET_i2s (&peer_entry->id), (unsigned int) ntohl (size_estimate_messages[idx].matching_bits)); -#endif if (ntohl (size_estimate_messages[idx].hop_count) == 0) GNUNET_STATISTICS_update (stats, "# flood messages started", 1, GNUNET_NO); GNUNET_STATISTICS_update (stats, "# flood messages transmitted", 1, @@ -887,10 +877,8 @@ find_proof (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (nse_work_required <= count_leading_zeroes (&result)) { my_proof = counter; -#if DEBUG_NSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Proof of work found: %llu!\n", (unsigned long long) GNUNET_ntohll (counter)); -#endif write_proof (); setup_flood_message (estimate_index, current_timestamp); return; @@ -900,10 +888,8 @@ find_proof (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } if (my_proof / (100 * ROUND_SIZE) < counter / (100 * ROUND_SIZE)) { -#if DEBUG_NSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing proofs currently at %llu\n", (unsigned long long) counter); -#endif /* remember progress every 100 rounds */ my_proof = counter; write_proof (); @@ -1207,10 +1193,8 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer, { struct NSEPeerEntry *peer_entry; -#if DEBUG_NSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%s' connected to us\n", GNUNET_i2s (peer)); -#endif peer_entry = GNUNET_malloc (sizeof (struct NSEPeerEntry)); peer_entry->id = *peer; GNUNET_assert (GNUNET_OK == @@ -1236,10 +1220,8 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) { struct NSEPeerEntry *pos; -#if DEBUG_NSE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%s' disconnected from us\n", GNUNET_i2s (peer)); -#endif pos = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey); if (NULL == pos) { diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c index 2fa8af2e5..9a44197c0 100644 --- a/src/nse/nse_api.c +++ b/src/nse/nse_api.c @@ -149,11 +149,9 @@ reschedule_connect (struct GNUNET_NSE_Handle *h) h->client = NULL; } -#if DEBUG_NSE LOG (GNUNET_ERROR_TYPE_DEBUG, "Scheduling task to reconnect to nse service in %llu ms.\n", h->reconnect_delay.rel_value); -#endif h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); if (h->reconnect_delay.rel_value == 0) @@ -187,16 +185,12 @@ send_start (void *cls, size_t size, void *buf) if (buf == NULL) { /* Connect error... */ -#if DEBUG_NSE LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutdown while trying to transmit `%s' request.\n", "START"); -#endif reschedule_connect (h); return 0; } -#if DEBUG_NSE LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request.\n", "START"); -#endif GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader)); msg = (struct GNUNET_MessageHeader *) buf; @@ -225,10 +219,8 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /* shutdown, just give up */ return; } -#if DEBUG_NSE LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to network size estimation service.\n"); -#endif GNUNET_assert (h->client == NULL); h->client = GNUNET_CLIENT_connect ("nse", h->cfg); GNUNET_assert (h->client != NULL); diff --git a/src/nse/test_nse_api.c b/src/nse/test_nse_api.c index f6cde3fe4..658c8b9a5 100644 --- a/src/nse/test_nse_api.c +++ b/src/nse/test_nse_api.c @@ -29,8 +29,6 @@ #include "gnunet_scheduler_lib.h" #include "gnunet_nse_service.h" -#define DEBUG_NSE GNUNET_YES - #define START_ARM GNUNET_YES static struct GNUNET_NSE_Handle *h; @@ -147,11 +145,7 @@ check () char *const argv[] = { "test-nse-api", "-c", "test_nse.conf", -#if DEBUG_NSE - "-L", "DEBUG", -#else "-L", "WARNING", -#endif NULL }; struct GNUNET_GETOPT_CommandLineOption options[] = { @@ -173,14 +167,9 @@ main (int argc, char *argv[]) int ret; GNUNET_log_setup ("test_nse_api", -#if DEBUG_NSE - "DEBUG", -#else "WARNING", -#endif NULL); ret = check (); - return ret; } diff --git a/src/peerinfo/perf_peerinfo_api.c b/src/peerinfo/perf_peerinfo_api.c index 1492e0789..8ad79b5b5 100755 --- a/src/peerinfo/perf_peerinfo_api.c +++ b/src/peerinfo/perf_peerinfo_api.c @@ -53,12 +53,11 @@ static int check_it (void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration) { -#if DEBUG if (addrlen > 0) { - FPRINTF (stderr, "name: %s, addr: %s\n", tname, (const char *) addr); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "name: %s, addr: %s\n", tname, (const char *) addr); } -#endif return GNUNET_OK; } @@ -107,17 +106,8 @@ static void process (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Message *hello, const char *err_msg) { - if (peer == NULL) + if (NULL != peer) { -#if DEBUG - FPRINTF (stderr, "Process received NULL response\n"); -#endif - } - else - { -#if DEBUG - FPRINTF (stderr, "Processed a peer\n"); -#endif numpeers++; if (0 && (hello != NULL)) GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &check_it, NULL); @@ -153,11 +143,7 @@ check () char *const argv[] = { "perf-peerinfo-api", "-c", "test_peerinfo_api_data.conf", -#if DEBUG_PEERINFO - "-L", "DEBUG", -#else "-L", "ERROR", -#endif NULL }; #if START_SERVICE @@ -169,11 +155,7 @@ check () proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-peerinfo", "gnunet-service-peerinfo", -#if DEBUG_PEERINFO - "-L", "DEBUG", -#else "-L", "ERROR", -#endif "-c", "test_peerinfo_api_data.conf", NULL); #endif GNUNET_assert (NULL != proc); @@ -191,7 +173,6 @@ check () GNUNET_OS_process_wait (proc); GNUNET_OS_process_close (proc); proc = NULL; - #endif return ok; } @@ -203,11 +184,7 @@ main (int argc, char *argv[]) int ret = 0; GNUNET_log_setup ("perf_peerinfo_api", -#if DEBUG_PEERINFO - "DEBUG", -#else "ERROR", -#endif NULL); ret = check (); GNUNET_DISK_directory_remove ("/tmp/test-gnunet-peerinfo"); diff --git a/src/peerinfo/test_peerinfo_api.c b/src/peerinfo/test_peerinfo_api.c index e4eb7d480..ebb12b505 100644 --- a/src/peerinfo/test_peerinfo_api.c +++ b/src/peerinfo/test_peerinfo_api.c @@ -170,9 +170,6 @@ check () char *const argv[] = { "test-peerinfo-api", "-c", "test_peerinfo_api_data.conf", -#if DEBUG_PEERINFO - "-L", "DEBUG", -#endif NULL }; struct GNUNET_GETOPT_CommandLineOption options[] = { @@ -181,9 +178,6 @@ check () proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-peerinfo", "gnunet-service-peerinfo", -#if DEBUG_PEERINFO - "-L", "DEBUG", -#endif "-c", "test_peerinfo_api_data.conf", NULL); GNUNET_assert (NULL != proc); GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, @@ -206,11 +200,7 @@ main (int argc, char *argv[]) int ret = 0; GNUNET_log_setup ("test_peerinfo_api", -#if DEBUG_PEERINFO - "DEBUG", -#else "WARNING", -#endif NULL); ret = check (); GNUNET_DISK_directory_remove ("/tmp/test-gnunet-peerinfo"); diff --git a/src/statistics/test_statistics_api.c b/src/statistics/test_statistics_api.c index 0647a4942..84d3f5a23 100644 --- a/src/statistics/test_statistics_api.c +++ b/src/statistics/test_statistics_api.c @@ -29,7 +29,6 @@ #include "gnunet_scheduler_lib.h" #include "gnunet_statistics_service.h" -#define DEBUG_STATISTICS GNUNET_EXTRA_LOGGING #define START_SERVICE GNUNET_YES @@ -130,11 +129,7 @@ check () char *const argv[] = { "test-statistics-api", "-c", "test_statistics_api_data.conf", -#if DEBUG_STATISTICS - "-L", "DEBUG", -#else "-L", "WARNING", -#endif NULL }; struct GNUNET_GETOPT_CommandLineOption options[] = { @@ -146,9 +141,6 @@ check () proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics", "gnunet-service-statistics", -#if DEBUG_STATISTICS - "-L", "DEBUG", -#endif "-c", "test_statistics_api_data.conf", NULL); #endif GNUNET_assert (NULL != proc); @@ -172,9 +164,6 @@ check () proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics", "gnunet-service-statistics", -#if DEBUG_STATISTICS - "-L", "DEBUG", -#endif "-c", "test_statistics_api_data.conf", NULL); #endif GNUNET_PROGRAM_run (5, argv, "test-statistics-api", "nohelp", options, @@ -198,11 +187,7 @@ main (int argc, char *argv[]) int ret; GNUNET_log_setup ("test_statistics_api", -#if DEBUG_STATISTICS - "DEBUG", -#else "WARNING", -#endif NULL); ret = check (); diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index bf43008bb..679d52937 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -230,32 +230,24 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, if (NULL == message) goto end; type = ntohs (message->type); -#if DEBUG_TRANSPORT - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received Message with type %u\n", type); -#endif - switch (type) { case GNUNET_MESSAGE_TYPE_HELLO: GST_validation_handle_hello (message); return ret; case GNUNET_MESSAGE_TYPE_TRANSPORT_PING: -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, "Processing `%s' from `%s'\n", "PING", (sender_address != NULL) ? GST_plugins_a2s (&address) : ""); -#endif GST_validation_handle_ping (peer, message, &address, session); break; case GNUNET_MESSAGE_TYPE_TRANSPORT_PONG: -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, "Processing `%s' from `%s'\n", "PONG", (sender_address != NULL) ? GST_plugins_a2s (&address) : ""); -#endif GST_validation_handle_pong (peer, message); break; case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT: @@ -290,11 +282,9 @@ end: * this connections seem to go extra-slow */ GNUNET_ATS_address_update (GST_ats, &address, session, ats, ats_count); #endif -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Allowing receive from peer %s to continue in %llu ms\n", GNUNET_i2s (peer), (unsigned long long) ret.rel_value); -#endif return ret; } @@ -346,10 +336,8 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_HELLO_Address address; GNUNET_assert (strlen (transport_name) > 0); -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Session %X to peer `%s' ended \n", session, GNUNET_i2s (peer)); -#endif if (NULL != session) GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, "transport-ats", @@ -430,11 +418,9 @@ ats_request_address_change (void *cls, /* ATS tells me to disconnect from peer */ if ((bw_in == 0) && (bw_out == 0)) { -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS tells me to disconnect from peer `%s'\n", GNUNET_i2s (&address->peer)); -#endif GST_neighbours_force_disconnect (&address->peer); return; } diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c index 3838c511a..870c083d2 100644 --- a/src/transport/gnunet-service-transport_hello.c +++ b/src/transport/gnunet-service-transport_hello.c @@ -166,13 +166,9 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_free (our_hello); our_hello = GNUNET_HELLO_create (&GST_my_public_key, &address_generator, &gc); GNUNET_assert (NULL != our_hello); - -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, "Refreshed my `%s', new size is %d\n", "HELLO", GNUNET_HELLO_size (our_hello)); -#endif - GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# refreshed my HELLO"), 1, GNUNET_NO); if (NULL != hello_cb) @@ -260,13 +256,11 @@ GST_hello_modify_addresses (int addremove, { struct OwnAddressList *al; -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - (add_remove == - GNUNET_YES) ? "Adding `%s':%s to the set of our addresses\n" : - "Removing `%s':%s from the set of our addresses\n", - GST_plugins_a2s (address), p->short_name); -#endif + (addremove == + GNUNET_YES) ? "Adding `%s' to the set of our addresses\n" : + "Removing `%s' from the set of our addresses\n", + GST_plugins_a2s (address)); GNUNET_assert (address != NULL); if (GNUNET_NO == addremove) { diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index efb0e4b77..00fe3bc4d 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -495,14 +495,10 @@ reset_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) n->state_reset = GNUNET_SCHEDULER_NO_TASK; if (n->state == S_CONNECTED) return; - -#if DEBUG_TRANSPORT GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# failed connection attempts due to timeout"), 1, GNUNET_NO); -#endif - /* resetting state */ if (n->state == S_FAST_RECONNECT) @@ -714,11 +710,9 @@ transmit_send_continuation (void *cls, n->transmission_task = GNUNET_SCHEDULER_add_now (&transmission_task, n); } } -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message of type %u was %s\n", ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type), (success == GNUNET_OK) ? "successful" : "FAILED"); -#endif if (NULL != mq->cont) mq->cont (mq->cont_cls, success); GNUNET_free (mq); @@ -763,10 +757,8 @@ try_transmission_to_peer (struct NeighbourMapEntry *n) if (n->address == NULL) { -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No address for peer `%s'\n", GNUNET_i2s (&n->id)); -#endif GNUNET_CONTAINER_DLL_remove (n->messages_head, n->messages_tail, mq); transmit_send_continuation (mq, &n->id, GNUNET_SYSERR); GNUNET_assert (n->transmission_task == GNUNET_SCHEDULER_NO_TASK); @@ -853,11 +845,9 @@ static void send_disconnect_cont (void *cls, const struct GNUNET_PeerIdentity *target, int result) { -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending DISCONNECT message to peer `%4s': %i\n", GNUNET_i2s (target), result); -#endif } @@ -867,12 +857,9 @@ send_disconnect (struct NeighbourMapEntry * n) size_t ret; struct SessionDisconnectMessage disconnect_msg; -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending DISCONNECT message to peer `%4s'\n", GNUNET_i2s (&n->id)); -#endif - disconnect_msg.header.size = htons (sizeof (struct SessionDisconnectMessage)); disconnect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT); @@ -1112,10 +1099,8 @@ disconnect_all_neighbours (void *cls, const GNUNET_HashCode * key, void *value) { struct NeighbourMapEntry *n = value; -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting peer `%4s', %s\n", GNUNET_i2s (&n->id), "SHUTDOWN_TASK"); -#endif if (S_CONNECTED == n->state) GNUNET_STATISTICS_update (GST_stats, gettext_noop @@ -1180,11 +1165,9 @@ send_outbound_quota (const struct GNUNET_PeerIdentity *target, { struct QuotaSetMessage q_msg; -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending outbound quota of %u Bps for peer `%s' to all clients\n", ntohl (quota.value__), GNUNET_i2s (target)); -#endif q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); q_msg.quota = quota; @@ -1232,11 +1215,9 @@ send_connect_continuation (void *cls, const struct GNUNET_PeerIdentity *target, if ((GNUNET_NO == success) && ((n->state == S_NOT_CONNECTED) || (n->state == S_CONNECT_SENT))) { -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to send CONNECT_MSG to peer `%4s' with address '%s' session %p, asking ATS for new address \n", GNUNET_i2s (&n->id), GST_plugins_a2s (n->address), n->session); -#endif change_state (n, S_NOT_CONNECTED); if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (n->ats_suggest); @@ -1350,11 +1331,9 @@ send_switch_address_continuation (void *cls, } break; case S_FAST_RECONNECT: -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successful fast reconnect to peer `%s'\n", GNUNET_i2s (&n->id)); -#endif change_state (n, S_CONNECTED); neighbours_connected++; GNUNET_STATISTICS_set (GST_stats, gettext_noop ("# peers connected"), neighbours_connected, @@ -1424,11 +1403,9 @@ send_connect_ack_continuation (void *cls, } /* sending failed, ask for next address */ -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to send CONNECT_MSG to peer `%4s' with address '%s' session %X, asking ATS for new address \n", GNUNET_i2s (&n->id), GST_plugins_a2s (n->address), n->session); -#endif if (n->state != S_NOT_CONNECTED) change_state (n, S_NOT_CONNECTED); GNUNET_assert (strlen (cc->address->transport_name) > 0); @@ -1763,10 +1740,8 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer) { struct NeighbourMapEntry *n; -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Unknown peer `%s', creating new neighbour\n", GNUNET_i2s (peer)); -#endif n = GNUNET_malloc (sizeof (struct NeighbourMapEntry)); n->id = *peer; n->state = S_NOT_CONNECTED; @@ -1800,10 +1775,8 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target) { return; } -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to connect to peer `%s'\n", GNUNET_i2s (target)); -#endif if (0 == memcmp (target, &GST_my_identity, sizeof (struct GNUNET_PeerIdentity))) { @@ -1823,12 +1796,9 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target) if (n == NULL) n = setup_neighbour (target); -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking ATS for suggested address to connect to peer `%s'\n", GNUNET_i2s (&n->id)); -#endif - GNUNET_ATS_suggest_address (GST_ats, &n->id); } @@ -1873,12 +1843,8 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, /* This can happen during shutdown */ return; } - -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Session %X to peer `%s' ended \n", session, GNUNET_i2s (peer)); -#endif - n = lookup_neighbour (peer); if (NULL == n) return; @@ -1974,7 +1940,6 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg, gettext_noop ("# messages not sent (no such peer or not connected)"), 1, GNUNET_NO); -#if DEBUG_TRANSPORT if (n == NULL) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Could not send message to peer `%s': unknown neighbour", @@ -1983,7 +1948,6 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Could not send message to peer `%s': not connected\n", GNUNET_i2s (target)); -#endif if (NULL != cont) cont (cont_cls, GNUNET_SYSERR); return; @@ -1995,12 +1959,9 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg, gettext_noop ("# messages not sent (no such peer or not connected)"), 1, GNUNET_NO); -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Could not send message to peer `%s': no address available\n", GNUNET_i2s (target)); -#endif - if (NULL != cont) cont (cont_cls, GNUNET_SYSERR); return; @@ -2075,12 +2036,10 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity if (GNUNET_YES == GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, size)) { n->quota_violation_count++; -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Bandwidth quota (%u b/s) violation detected (total of %u).\n", n->in_tracker.available_bytes_per_s__, n->quota_violation_count); -#endif /* Discount 32k per violation */ GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, -32 * 1024); } @@ -2106,14 +2065,12 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 32 * 1024); if (ret.rel_value > 0) { -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Throttling read (%llu bytes excess at %u b/s), waiting %llu ms before reading more.\n", (unsigned long long) n->in_tracker. consumption_since_last_update__, (unsigned int) n->in_tracker.available_bytes_per_s__, (unsigned long long) ret.rel_value); -#endif GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# ms throttling suggested"), (int64_t) ret.rel_value, GNUNET_NO); @@ -2216,11 +2173,8 @@ GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour, n->latency = GNUNET_TIME_absolute_get_difference (n->keep_alive_sent, GNUNET_TIME_absolute_get ()); -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Latency for peer `%s' is %llu ms\n", GNUNET_i2s (&n->id), n->latency.rel_value); -#endif - if (n->latency.rel_value == GNUNET_TIME_relative_get_forever ().rel_value) { @@ -2275,18 +2229,14 @@ GST_neighbours_set_incoming_quota (const struct GNUNET_PeerIdentity *neighbour, 1, GNUNET_NO); return; } -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Setting inbound quota of %u Bps for peer `%s' to all clients\n", ntohl (quota.value__), GNUNET_i2s (&n->id)); -#endif GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, quota); if (0 != ntohl (quota.value__)) return; -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting peer `%4s' due to `%s'\n", GNUNET_i2s (&n->id), "SET_QUOTA"); -#endif if (is_connected (n)) GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# disconnects due to quota of 0"), @@ -2396,12 +2346,9 @@ GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity const struct SessionDisconnectMessage *sdm; GNUNET_HashCode hc; -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received DISCONNECT message from peer `%s'\n", GNUNET_i2s (peer)); -#endif - if (ntohs (msg->size) != sizeof (struct SessionDisconnectMessage)) { // GNUNET_break_op (0); @@ -2585,12 +2532,10 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, neighbours_connected++; GNUNET_STATISTICS_set (GST_stats, gettext_noop ("# peers connected"), neighbours_connected, GNUNET_NO); -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Notify about connect of `%4s' using address '%s' session %X LINE %u\n", GNUNET_i2s (&n->id), GST_plugins_a2s (n->address), n->session, __LINE__); -#endif connect_notify_cb (callback_cls, &n->id, ats, ats_count); send_outbound_quota (peer, n->bandwidth_out); @@ -2607,11 +2552,8 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message, { struct NeighbourMapEntry *n; -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ACK message from peer `%s'\n", GNUNET_i2s (peer)); -#endif - if (ntohs (message->size) != sizeof (struct GNUNET_MessageHeader)) { GNUNET_break_op (0); @@ -2656,12 +2598,10 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message, GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in); if (n->keepalive_task == GNUNET_SCHEDULER_NO_TASK) n->keepalive_task = GNUNET_SCHEDULER_add_now (&neighbour_keepalive_task, n); -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Notify about connect of `%4s' using address '%s' session %X LINE %u\n", GNUNET_i2s (&n->id), GST_plugins_a2s (n->address), n->session, __LINE__); -#endif connect_notify_cb (callback_cls, &n->id, ats, ats_count); send_outbound_quota (peer, n->bandwidth_out); } @@ -2688,13 +2628,10 @@ handle_connect_blacklist_cont (void *cls, struct NeighbourMapEntry *n; struct BlackListCheckContext *bcc = cls; -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Blacklist check due to CONNECT message: `%s'\n", GNUNET_i2s (peer), (result == GNUNET_OK) ? "ALLOWED" : "FORBIDDEN"); -#endif - /* not allowed */ if (GNUNET_OK != result) { @@ -2762,11 +2699,8 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, struct BlackListCheckContext *bcc = NULL; struct NeighbourMapEntry *n; -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONNECT message from peer `%s'\n", GNUNET_i2s (peer)); -#endif - if (ntohs (message->size) != sizeof (struct SessionConnectMessage)) { GNUNET_break_op (0); diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 75ff4eb6f..ff786079f 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c @@ -870,10 +870,8 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, PONG_SIGNATURE_LIFETIME.rel_value / 4) { /* create / update cached sig */ -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating PONG signature to indicate ownership.\n"); -#endif *sig_cache_exp = GNUNET_TIME_relative_to_absolute (PONG_SIGNATURE_LIFETIME); pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp); GNUNET_assert (GNUNET_OK == @@ -1083,13 +1081,9 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, GNUNET_NO); return; } -#if DEBUG_TRANSPORT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Address validated for peer `%s' with plugin `%s': `%s'\n", - GNUNET_i2s (sender), tname, GST_plugins_a2s (tname, addr, - addrlen)); -#endif - + GNUNET_i2s (sender), tname, GST_plugins_a2s (&address)); /* validity achieved, remember it! */ ve->expecting_pong = GNUNET_NO; ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION); diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index 48db6a372..4f9279495 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c @@ -786,23 +786,17 @@ http_plugin_send (void *cls, if (session->inbound == GNUNET_NO) { -#if DEBUG_HTTP GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Using outbound client session %p to send to `%s'\n", session, GNUNET_i2s (&session->target)); -#endif - client_send (session, msg); res = msgbuf_size; } if (session->inbound == GNUNET_YES) { -#if DEBUG_HTTP GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Using inbound server %p session to send to `%s'\n", session, GNUNET_i2s (&session->target)); -#endif - server_send (session, msg); res = msgbuf_size; } @@ -1556,11 +1550,8 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls) /* Report addresses to transport service */ start_report_addresses (plugin); -#if DEBUG_HTTP GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Plugin `%s' loaded\n", plugin->name); -#endif - return api; } @@ -1588,10 +1579,8 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) s = plugin->head; while (s != NULL) { -#if DEBUG_HTTP GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Disconnecting `%s' \n", GNUNET_i2s (&s->target)); -#endif if (s->inbound == GNUNET_NO) GNUNET_assert (GNUNET_OK == client_disconnect (s)); else @@ -1599,15 +1588,11 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) s = s->next; } -#if DEBUG_HTTP GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Stopping server\n"); -#endif /* Stop server */ server_stop (plugin); -#if DEBUG_HTTP GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Stopping client\n"); -#endif /* Stop client */ client_stop (plugin); @@ -1639,17 +1624,12 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) s = t; } - -#if DEBUG_HTTP GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Plugin `%s' unloaded\n", plugin->name); -#endif - GNUNET_free_non_null (plugin->server_addr_v4); GNUNET_free_non_null (plugin->server_addr_v6); GNUNET_free (plugin); GNUNET_free (api); - return NULL; } diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 0a6e0c52c..96b465291 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c @@ -229,10 +229,7 @@ server_load_certificate (struct Plugin *plugin) } GNUNET_free (key_file); GNUNET_free (cert_file); -#if DEBUG_HTTP GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TLS certificate loaded\n"); -#endif - return res; } #endif @@ -1168,13 +1165,9 @@ server_start (struct Plugin *plugin) return GNUNET_SYSERR; } server_reschedule (plugin, plugin->server_v6, GNUNET_NO); - - -#if DEBUG_HTTP GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "%s server component started on port %u\n", plugin->name, plugin->port); -#endif return res; } @@ -1249,10 +1242,8 @@ server_stop (struct Plugin *plugin) GNUNET_free_non_null (plugin->key); #endif -#if DEBUG_HTTP GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "%s server component stopped\n", plugin->name); -#endif } diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c index d378f2663..623cde2bd 100644 --- a/src/transport/plugin_transport_udp_broadcasting.c +++ b/src/transport/plugin_transport_udp_broadcasting.c @@ -105,12 +105,10 @@ broadcast_ipv6_mst_cb (void *cls, void *client, if (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON != ntohs (msg->header.type)) return; -#if DEBUG_UDP_BROADCASTING LOG (GNUNET_ERROR_TYPE_DEBUG, "Received beacon with %u bytes from peer `%s' via address `%s'\n", ntohs (msg->header.size), GNUNET_i2s (&msg->sender), udp_address_to_string (NULL, &mc->addr, sizeof (mc->addr))); -#endif struct GNUNET_ATS_Information atsi[2]; /* setup ATS */ @@ -146,12 +144,10 @@ broadcast_ipv4_mst_cb (void *cls, void *client, if (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON != ntohs (msg->header.type)) return; -#if DEBUG_UDP_BROADCASTING LOG (GNUNET_ERROR_TYPE_DEBUG, "Received beacon with %u bytes from peer `%s' via address `%s'\n", ntohs (msg->header.size), GNUNET_i2s (&msg->sender), udp_address_to_string (NULL, &mc->addr, sizeof (mc->addr))); -#endif struct GNUNET_ATS_Information atsi[2]; @@ -181,11 +177,9 @@ udp_broadcast_receive (struct Plugin *plugin, const char * buf, ssize_t size, st if (addrlen == sizeof (struct sockaddr_in)) { -#if DEBUG_UDP_BROADCASTING LOG (GNUNET_ERROR_TYPE_DEBUG, "Received IPv4 HELLO beacon broadcast with %i bytes from address %s\n", size, GNUNET_a2s ((const struct sockaddr *) addr, addrlen)); -#endif struct Mstv4Context *mc; mc = GNUNET_malloc (sizeof (struct Mstv4Context)); @@ -202,11 +196,9 @@ udp_broadcast_receive (struct Plugin *plugin, const char * buf, ssize_t size, st } else if (addrlen == sizeof (struct sockaddr_in6)) { -#if DEBUG_UDP_BROADCASTING LOG (GNUNET_ERROR_TYPE_DEBUG, "Received IPv6 HELLO beacon broadcast with %i bytes from address %s\n", size, GNUNET_a2s ((const struct sockaddr *) &addr, addrlen)); -#endif struct Mstv6Context *mc; mc = GNUNET_malloc (sizeof (struct Mstv6Context)); @@ -329,7 +321,6 @@ iface_proc (void *cls, const char *name, int isDefault, if (addr != NULL) { -#if DEBUG_UDP_BROADCASTING GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "address %s for interface %s %p\n ", GNUNET_a2s (addr, addrlen), name, addr); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -337,7 +328,6 @@ iface_proc (void *cls, const char *name, int isDefault, GNUNET_a2s (broadcast_addr, addrlen), name, broadcast_addr); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "netmask %s for interface %s %p\n ", GNUNET_a2s (netmask, addrlen), name, netmask); -#endif /* Collecting broadcast addresses */ if (broadcast_addr != NULL) @@ -430,9 +420,7 @@ setup_broadcast (struct Plugin *plugin, struct sockaddr_in6 *serverAddrv6, struc } else { -#if DEBUG_UDP LOG (GNUNET_ERROR_TYPE_DEBUG, "IPv6 broadcasting running\n"); -#endif plugin->send_ipv6_broadcast_task = GNUNET_SCHEDULER_add_now (&udp_ipv6_broadcast_send, plugin); plugin->broadcast_ipv6 = GNUNET_YES; @@ -483,9 +471,7 @@ stop_broadcast (struct Plugin *plugin) } else { -#if DEBUG_UDP LOG (GNUNET_ERROR_TYPE_DEBUG, "IPv6 Broadcasting stopped\n"); -#endif } if (plugin->send_ipv6_broadcast_task != GNUNET_SCHEDULER_NO_TASK) diff --git a/src/transport/transport.h b/src/transport/transport.h index 027720271..e0b881970 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h @@ -33,11 +33,6 @@ #define DEBUG_TRANSPORT GNUNET_EXTRA_LOGGING -#define DEBUG_TRANSPORT_TIMEOUT GNUNET_EXTRA_LOGGING - -#define DEBUG_TRANSPORT_DISCONNECT GNUNET_EXTRA_LOGGING - -#define DEBUG_TRANSPORT_API GNUNET_EXTRA_LOGGING /** * For how long do we allow unused bandwidth diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index e7f2327d9..b97a24596 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c @@ -342,10 +342,8 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h, { struct Neighbour *n; -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Creating entry for neighbour `%4s'.\n", GNUNET_i2s (pid)); -#endif n = GNUNET_malloc (sizeof (struct Neighbour)); n->id = *pid; n->h = h; @@ -416,10 +414,8 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_assert (h->client != NULL); if (msg == NULL) { -#if DEBUG_TRANSPORT_API - LOG (GNUNET_ERROR_TYPE_INFO, + LOG (GNUNET_ERROR_TYPE_DEBUG, "Error receiving from transport service, disconnecting temporarily.\n"); -#endif disconnect_and_schedule_reconnect (h); return; } @@ -435,11 +431,9 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_break (0); break; } -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving (my own) `%s' message, I am `%4s'.\n", "HELLO", GNUNET_i2s (&me)); -#endif GNUNET_free_non_null (h->my_hello); h->my_hello = NULL; if (size < sizeof (struct GNUNET_MessageHeader)) @@ -474,10 +468,8 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) break; } ats = (const struct GNUNET_ATS_Information *) &cim[1]; -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message for `%4s'.\n", "CONNECT", GNUNET_i2s (&cim->id)); -#endif n = neighbour_find (h, &cim->id); if (n != NULL) { @@ -496,10 +488,8 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) } dim = (const struct DisconnectInfoMessage *) msg; GNUNET_break (ntohl (dim->reserved) == 0); -#if DEBUG_TRANSPORT_API_DISCONNECT LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message for `%4s'.\n", "DISCONNECT", GNUNET_i2s (&dim->peer)); -#endif n = neighbour_find (h, &dim->peer); if (n == NULL) { @@ -515,10 +505,8 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) break; } okm = (const struct SendOkMessage *) msg; -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message, transmission %s.\n", "SEND_OK", ntohl (okm->success) == GNUNET_OK ? "succeeded" : "failed"); -#endif n = neighbour_find (h, &okm->peer); if (n == NULL) break; @@ -536,9 +524,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) } break; case GNUNET_MESSAGE_TYPE_TRANSPORT_RECV: -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message.\n", "RECV"); -#endif if (size < sizeof (struct InboundMessage) + sizeof (struct GNUNET_MessageHeader)) { @@ -555,10 +541,8 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) GNUNET_break (0); break; } -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Received message of type %u from `%4s'.\n", ntohs (imm->type), GNUNET_i2s (&im->peer)); -#endif n = neighbour_find (h, &im->peer); if (n == NULL) { @@ -569,9 +553,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) h->rec (h->cls, &im->peer, imm, ats, ats_count); break; case GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA: -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message.\n", "SET_QUOTA"); -#endif if (size != sizeof (struct QuotaSetMessage)) { GNUNET_break (0); @@ -653,10 +635,8 @@ transport_notify_ready (void *cls, size_t size, void *buf) { GNUNET_CONTAINER_DLL_remove (h->control_head, h->control_tail, th); nret = th->notify (th->notify_cls, size, &cbuf[ret]); -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Added %u bytes of control message at %u\n", nret, ret); -#endif GNUNET_free (th); ret += nret; size -= nret; @@ -714,10 +694,8 @@ transport_notify_ready (void *cls, size_t size, void *buf) } /* if there are more pending messages, try to schedule those */ schedule_transmission (h); -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting %u bytes to transport service\n", ret); -#endif return ret; } @@ -750,11 +728,9 @@ schedule_transmission_task (void *cls, n->th = NULL; GNUNET_assert (n == GNUNET_CONTAINER_heap_remove_root (h->ready_heap)); n->hn = NULL; -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Signalling timeout for transmission to peer %s due to congestion\n", GNUNET_i2s (&n->id)); -#endif GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); GNUNET_free (th); } @@ -771,9 +747,7 @@ schedule_transmission_task (void *cls, return; /* no pending messages */ size = n->th->notify_size + sizeof (struct OutboundMessage); } -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Calling notify_transmit_ready\n"); -#endif h->cth = GNUNET_CLIENT_notify_transmit_ready (h->client, size, GNUNET_TIME_UNIT_FOREVER_REL, @@ -809,11 +783,9 @@ schedule_transmission (struct GNUNET_TRANSPORT_Handle *h) n->th->notify_size); else return; /* no work to be done */ -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Scheduling next transmission to service in %llu ms\n", (unsigned long long) delay.rel_value); -#endif h->quota_task = GNUNET_SCHEDULER_add_delayed (delay, &schedule_transmission_task, h); } @@ -835,10 +807,8 @@ schedule_control_transmit (struct GNUNET_TRANSPORT_Handle *h, size_t size, { struct GNUNET_TRANSPORT_TransmitHandle *th; -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Control transmit of %u bytes requested\n", size); -#endif th = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_TransmitHandle)); th->notify = notify; th->notify_cls = notify_cls; @@ -866,15 +836,11 @@ send_start (void *cls, size_t size, void *buf) if (buf == NULL) { /* Can only be shutdown, just give up */ -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutdown while trying to transmit `%s' request.\n", "START"); -#endif return 0; } -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request.\n", "START"); -#endif GNUNET_assert (size >= sizeof (struct StartMessage)); s.header.size = htons (sizeof (struct StartMessage)); s.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_START); @@ -909,9 +875,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /* shutdown, just give up */ return; } -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n"); -#endif GNUNET_assert (h->client == NULL); GNUNET_assert (h->control_head == NULL); GNUNET_assert (h->control_tail == NULL); @@ -956,11 +920,9 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h) th->notify (th->notify_cls, 0, NULL); GNUNET_free (th); } -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Scheduling task to reconnect to transport service in %llu ms.\n", h->reconnect_delay.rel_value); -#endif h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); if (h->reconnect_delay.rel_value == 0) @@ -995,11 +957,9 @@ send_try_connect (void *cls, size_t size, void *buf) GNUNET_free (pid); return 0; } -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request with respect to `%4s'.\n", "REQUEST_CONNECT", GNUNET_i2s (pid)); -#endif GNUNET_assert (size >= sizeof (struct TransportRequestConnectMessage)); msg.header.size = htons (sizeof (struct TransportRequestConnectMessage)); msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT); @@ -1050,16 +1010,12 @@ send_hello (void *cls, size_t size, void *buf) if (buf == NULL) { -#if DEBUG_TRANSPORT_TIMEOUT LOG (GNUNET_ERROR_TYPE_DEBUG, "Timeout while trying to transmit `%s' request.\n", "HELLO"); -#endif GNUNET_free (msg); return 0; } -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting `%s' request.\n", "HELLO"); -#endif ssize = ntohs (msg->size); GNUNET_assert (size >= ssize); memcpy (buf, msg, ssize); @@ -1101,11 +1057,9 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, } msg = GNUNET_malloc (size); memcpy (msg, hello, size); -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Offering `%s' message of `%4s' to transport for validation.\n", "HELLO", GNUNET_i2s (&peer)); -#endif schedule_control_transmit (handle, size, &send_hello, msg); } @@ -1204,9 +1158,7 @@ GNUNET_TRANSPORT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, void GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) { -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Transport disconnect called!\n"); -#endif /* this disconnects all neighbours... */ if (handle->reconnect_task == GNUNET_SCHEDULER_NO_TASK) disconnect_and_schedule_reconnect (handle); @@ -1291,11 +1243,9 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle, delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size); if (delay.rel_value > timeout.rel_value) delay.rel_value = 0; /* notify immediately (with failure) */ -#if DEBUG_TRANSPORT_API LOG (GNUNET_ERROR_TYPE_DEBUG, "Bandwidth tracker allows next transmission to peer %s in %llu ms\n", GNUNET_i2s (target), (unsigned long long) delay.rel_value); -#endif n->hn = GNUNET_CONTAINER_heap_insert (handle->ready_heap, n, delay.rel_value); schedule_transmission (handle); return th; diff --git a/src/util/container_heap.c b/src/util/container_heap.c index c34e220ce..b9cab1e9c 100644 --- a/src/util/container_heap.c +++ b/src/util/container_heap.c @@ -30,7 +30,7 @@ #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) -#define DEBUG 0 +#define EXTRA_CHECKS 0 /** * Node in the heap. @@ -104,7 +104,7 @@ struct GNUNET_CONTAINER_Heap }; -#if DEBUG +#if EXTRA_CHECKS /** * Check if internal invariants hold for the given node. * @@ -401,7 +401,7 @@ GNUNET_CONTAINER_heap_remove_root (struct GNUNET_CONTAINER_Heap *heap) insert_node (heap, heap->root, root->right_child); } GNUNET_free (root); -#if DEBUG +#if EXTRA_CHECKS GNUNET_assert (((heap->size == 0) && (heap->root == NULL)) || (heap->size == heap->root->tree_size + 1)); CHECK (heap->root); @@ -502,7 +502,7 @@ GNUNET_CONTAINER_heap_remove_node (struct GNUNET_CONTAINER_HeapNode *node) if (heap->walk_pos == node) heap->walk_pos = NULL; GNUNET_free (node); -#if DEBUG +#if EXTRA_CHECKS CHECK (heap->root); GNUNET_assert (((heap->size == 0) && (heap->root == NULL)) || (heap->size == heap->root->tree_size + 1)); @@ -523,13 +523,13 @@ GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap, struct GNUNET_CONTAINER_HeapNode *node, GNUNET_CONTAINER_HeapCostType new_cost) { -#if DEBUG +#if EXTRA_CHECKS GNUNET_assert (((heap->size == 0) && (heap->root == NULL)) || (heap->size == heap->root->tree_size + 1)); CHECK (heap->root); #endif remove_node (node); -#if DEBUG +#if EXTRA_CHECKS CHECK (heap->root); GNUNET_assert (((heap->size == 1) && (heap->root == NULL)) || (heap->size == heap->root->tree_size + 2)); @@ -539,7 +539,7 @@ GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_Heap *heap, heap->root = node; else insert_node (heap, heap->root, node); -#if DEBUG +#if EXTRA_CHECKS CHECK (heap->root); GNUNET_assert (((heap->size == 0) && (heap->root == NULL)) || (heap->size == heap->root->tree_size + 1)); diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c index f20666a38..97eba6d11 100644 --- a/src/util/gnunet-service-resolver.c +++ b/src/util/gnunet-service-resolver.c @@ -490,10 +490,8 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } -#if DEBUG_RESOLVER - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Resolver asked to look up `%s'.\n"), + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Resolver asked to look up `%s'.\n", hostname); -#endif get_ip_from_hostname (client, hostname, af); return; } @@ -521,15 +519,13 @@ handle_get (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); return; } -#if DEBUG_RESOLVER { char buf[INET6_ADDRSTRLEN]; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - _("Resolver asked to look up IP address `%s'.\n"), + "Resolver asked to look up IP address `%s'.\n", inet_ntop (af, ip, buf, sizeof (buf))); } -#endif get_ip_as_string (client, af, ip); } diff --git a/src/util/resolver.h b/src/util/resolver.h index 2c0de9910..b77c19926 100644 --- a/src/util/resolver.h +++ b/src/util/resolver.h @@ -27,8 +27,6 @@ #include "gnunet_common.h" -#define DEBUG_RESOLVER GNUNET_EXTRA_LOGGING - GNUNET_NETWORK_STRUCT_BEGIN /** diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index ab0574efa..87b76f12d 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c @@ -250,9 +250,7 @@ GNUNET_RESOLVER_disconnect () GNUNET_assert (NULL == req_tail); if (NULL != client) { -#if DEBUG_RESOLVER LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from DNS service\n"); -#endif GNUNET_CLIENT_disconnect (client); client = NULL; } @@ -339,9 +337,7 @@ handle_response (void *cls, const struct GNUNET_MessageHeader *msg) struct GNUNET_RESOLVER_RequestHandle *rh = cls; uint16_t size; -#if DEBUG_RESOLVER LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving response from DNS service\n"); -#endif if (msg == NULL) { char buf[INET6_ADDRSTRLEN]; @@ -422,10 +418,8 @@ handle_response (void *cls, const struct GNUNET_MessageHeader *msg) reconnect (); return; } -#if DEBUG_RESOLVER - LOG (GNUNET_ERROR_TYPE_DEBUG, _("Resolver returns `%s' for IP `%s'.\n"), + LOG (GNUNET_ERROR_TYPE_DEBUG, "Resolver returns `%s' for IP `%s'.\n", hostname, GNUNET_a2s ((const void *) &rh[1], rh->data_len)); -#endif if (rh->was_transmitted != GNUNET_SYSERR) rh->name_callback (rh->cls, hostname); rh->received_response = GNUNET_YES; @@ -633,10 +627,8 @@ process_requests () msg->direction = htonl (rh->direction); msg->af = htonl (rh->af); memcpy (&msg[1], &rh[1], rh->data_len); -#if DEBUG_RESOLVER LOG (GNUNET_ERROR_TYPE_DEBUG, "Transmitting DNS resolution request to DNS service\n"); -#endif if (GNUNET_OK != GNUNET_CLIENT_transmit_and_get_response (client, &msg->header, GNUNET_TIME_absolute_get_remaining @@ -666,9 +658,7 @@ reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) return; /* no work pending */ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) return; -#if DEBUG_RESOLVER LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying to connect to DNS service\n"); -#endif client = GNUNET_CLIENT_connect ("resolver", resolver_cfg); if (NULL == client) { @@ -712,11 +702,9 @@ reconnect () break; } } -#if DEBUG_RESOLVER LOG (GNUNET_ERROR_TYPE_DEBUG, "Will try to connect to DNS service in %llu ms\n", (unsigned long long) backoff.rel_value); -#endif GNUNET_assert (NULL != resolver_cfg); r_task = GNUNET_SCHEDULER_add_delayed (backoff, &reconnect_task, NULL); backoff = GNUNET_TIME_relative_multiply (backoff, 2); @@ -803,9 +791,7 @@ numeric_reverse (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) char *result; result = no_resolve (rh->af, &rh[1], rh->data_len); -#if DEBUG_RESOLVER - LOG (GNUNET_ERROR_TYPE_DEBUG, _("Resolver returns `%s'.\n"), result); -#endif + LOG (GNUNET_ERROR_TYPE_DEBUG, "Resolver returns `%s'.\n", result); if (result != NULL) { rh->name_callback (rh->cls, result); @@ -897,9 +883,7 @@ GNUNET_RESOLVER_local_fqdn_get () "gethostname"); return NULL; } -#if DEBUG_RESOLVER - LOG (GNUNET_ERROR_TYPE_DEBUG, _("Resolving our FQDN `%s'\n"), hostname); -#endif + LOG (GNUNET_ERROR_TYPE_DEBUG, "Resolving our FQDN `%s'\n", hostname); host = gethostbyname (hostname); if (NULL == host) { @@ -934,9 +918,7 @@ GNUNET_RESOLVER_hostname_resolve (int af, "gethostname"); return NULL; } -#if DEBUG_RESOLVER - LOG (GNUNET_ERROR_TYPE_DEBUG, _("Resolving our hostname `%s'\n"), hostname); -#endif + LOG (GNUNET_ERROR_TYPE_DEBUG, "Resolving our hostname `%s'\n", hostname); return GNUNET_RESOLVER_ip_get (hostname, af, timeout, callback, cls); } diff --git a/src/util/test_configuration.c b/src/util/test_configuration.c index b1a446f86..1242a5c8d 100644 --- a/src/util/test_configuration.c +++ b/src/util/test_configuration.c @@ -28,7 +28,6 @@ #include "gnunet_configuration_lib.h" #include "gnunet_disk_lib.h" -#define DEBUG GNUNET_EXTRA_LOGGING /* Test Configuration Diffs Options */ enum @@ -40,10 +39,8 @@ enum ADD_NEW_ENTRY, REMOVE_SECTION, REMOVE_ENTRY, - COMPARE -#if DEBUG - , PRINT -#endif + COMPARE, + PRINT }; static struct GNUNET_CONFIGURATION_Handle *cfg; -- 2.25.1