From: Christian Grothoff Date: Sun, 26 Feb 2012 14:02:09 +0000 (+0000) Subject: -eliminating #if DEBUG checks X-Git-Tag: initial-import-from-subversion-38251~14644 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a9763a49d78b240fed1ace9068a0ea11cdff00f7;p=oweals%2Fgnunet.git -eliminating #if DEBUG checks --- diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 741ca1917..b23d14b87 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -31,7 +31,6 @@ #include "fs_api.h" #include "fs_tree.h" -#define DEBUG_DOWNLOAD GNUNET_EXTRA_LOGGING /** * Determine if the given download (options and meta data) should cause @@ -240,11 +239,9 @@ encrypt_existing_match (struct GNUNET_FS_DownloadContext *dc, GNUNET_break_op (0); return GNUNET_SYSERR; } -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Matching block for `%s' at offset %llu already present, no need for download!\n", dc->filename, (unsigned long long) dr->offset); -#endif /* already got it! */ prc.dc = dc; prc.data = enc; @@ -564,10 +561,8 @@ match_full_data (void *cls, const char *plugin_name, if (type != EXTRACTOR_METATYPE_GNUNET_FULL_DATA) return 0; -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u bytes of FD!\n", (unsigned int) data_len); -#endif if (GNUNET_FS_uri_chk_get_file_size (dc->uri) != data_len) { GNUNET_break_op (0); @@ -731,12 +726,10 @@ schedule_block_download (struct GNUNET_FS_DownloadContext *dc, GNUNET_break (0); return; } -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Scheduling download at offset %llu and depth %u for `%s'\n", (unsigned long long) dr->offset, dr->depth, GNUNET_h2s (&dr->chk.query)); -#endif if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains_value (dc->active, &dr->chk.query, dr)) @@ -882,13 +875,11 @@ trigger_recursive_download (void *cls, const char *filename, } temp_name = NULL; -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Triggering recursive download of size %llu with %u bytes MD\n", (unsigned long long) GNUNET_FS_uri_chk_get_file_size (uri), (unsigned int) GNUNET_CONTAINER_meta_data_get_serialized_size (meta)); -#endif GNUNET_FS_download_start (dc->h, uri, meta, full_name, temp_name, 0, GNUNET_FS_uri_chk_get_file_size (uri), dc->anonymity, dc->options, NULL, dc); @@ -945,14 +936,11 @@ process_result_with_request (void *cls, const GNUNET_HashCode * key, int i; struct ContentHashKey *chkarr; -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received block `%s' matching pending request at depth %u and offset %llu/%llu\n", GNUNET_h2s (key), dr->depth, (unsigned long long) dr->offset, (unsigned long long) GNUNET_ntohll (dc->uri->data. chk.file_length)); - -#endif bs = GNUNET_FS_tree_calculate_block_size (GNUNET_ntohll (dc->uri->data.chk.file_length), dr->offset, dr->depth); @@ -1013,11 +1001,9 @@ process_result_with_request (void *cls, const GNUNET_HashCode * key, dc->filename, STRERROR (errno)); goto signal_error; } -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Saving decrypted block to disk at offset %llu\n", (unsigned long long) off); -#endif if ((off != GNUNET_DISK_file_seek (fh, off, GNUNET_DISK_SEEK_SET))) { GNUNET_asprintf (&dc->emsg, @@ -1089,12 +1075,10 @@ process_result_with_request (void *cls, const GNUNET_HashCode * key, if (dc->completed == dc->length) { /* download completed, signal */ -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download completed, truncating file to desired length %llu\n", (unsigned long long) GNUNET_ntohll (dc->uri->data. chk.file_length)); -#endif /* truncate file to size (since we store IBlocks at the end) */ if (dc->filename != NULL) { @@ -1114,11 +1098,9 @@ process_result_with_request (void *cls, const GNUNET_HashCode * key, return GNUNET_YES; } -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Triggering downloads of children (this block was at depth %u and offset %llu)\n", dr->depth, (unsigned long long) dr->offset); -#endif GNUNET_assert (0 == (prc->size % sizeof (struct ContentHashKey))); chkarr = (struct ContentHashKey *) pt; for (i = (prc->size / sizeof (struct ContentHashKey)) - 1; i >= 0; i--) @@ -1210,11 +1192,9 @@ process_result (struct GNUNET_FS_DownloadContext *dc, prc.do_store = GNUNET_YES; prc.last_transmission = last_transmission; GNUNET_CRYPTO_hash (data, size, &prc.query); -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received result for query `%s' from `%s'-service\n", GNUNET_h2s (&prc.query), "FS"); -#endif GNUNET_CONTAINER_multihashmap_get_multiple (dc->active, &prc.query, &process_result_with_request, &prc); @@ -1278,10 +1258,8 @@ transmit_download_request (void *cls, size_t size, void *buf) dc->th = NULL; if (NULL == buf) { -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting download request failed, trying to reconnect\n"); -#endif try_reconnect (dc); return 0; } @@ -1291,11 +1269,9 @@ transmit_download_request (void *cls, size_t size, void *buf) while ((NULL != (dr = dc->pending_head)) && (size >= msize + sizeof (struct SearchMessage))) { -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting download request for `%s' to `%s'-service\n", GNUNET_h2s (&dr->chk.query), "FS"); -#endif memset (sm, 0, sizeof (struct SearchMessage)); sm->header.size = htons (sizeof (struct SearchMessage)); sm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH); @@ -1405,10 +1381,8 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc) if (NULL != dc->client) { -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving all requests back to pending list\n"); -#endif if (NULL != dc->th) { GNUNET_CLIENT_notify_transmit_ready_cancel (dc->th); @@ -1422,9 +1396,7 @@ try_reconnect (struct GNUNET_FS_DownloadContext *dc) dc->in_receive = GNUNET_NO; dc->client = NULL; } -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Will try to reconnect in 1s\n"); -#endif dc->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_reconnect, dc); @@ -1443,9 +1415,7 @@ activate_fs_download (void *cls, struct GNUNET_CLIENT_Connection *client) struct GNUNET_FS_DownloadContext *dc = cls; struct GNUNET_FS_ProgressInfo pi; -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download activated\n"); -#endif GNUNET_assert (NULL != client); GNUNET_assert (dc->client == NULL); GNUNET_assert (dc->th == NULL); @@ -1455,10 +1425,8 @@ activate_fs_download (void *cls, struct GNUNET_CLIENT_Connection *client) dc->pending_head = NULL; dc->pending_tail = NULL; GNUNET_CONTAINER_multihashmap_iterate (dc->active, &retry_entry, dc); -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking for transmission to FS service\n"); -#endif if (dc->pending_head != NULL) { dc->th = @@ -1483,9 +1451,7 @@ deactivate_fs_download (void *cls) struct GNUNET_FS_DownloadContext *dc = cls; struct GNUNET_FS_ProgressInfo pi; -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download deactivated\n"); -#endif if (NULL != dc->th) { GNUNET_CLIENT_notify_transmit_ready_cancel (dc->th); @@ -1705,12 +1671,10 @@ reconstruct_cb (void *cls, const struct ContentHashKey *chk, uint64_t offset, if (dc->completed == dc->length) { /* download completed, signal */ -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download completed, truncating file to desired length %llu\n", (unsigned long long) GNUNET_ntohll (dc->uri->data. chk.file_length)); -#endif /* truncate file to size (since we store IBlocks at the end) */ if (dc->filename != NULL) { @@ -1792,9 +1756,7 @@ GNUNET_FS_download_start_task_ (void *cls, struct GNUNET_FS_ProgressInfo pi; struct GNUNET_DISK_FileHandle *fh; -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start task running...\n"); -#endif dc->task = GNUNET_SCHEDULER_NO_TASK; if (dc->length == 0) { @@ -1850,10 +1812,8 @@ GNUNET_FS_download_start_task_ (void *cls, if (dc->rfh != NULL) { /* first, try top-down */ -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying top-down reconstruction for `%s'\n", dc->filename); -#endif try_top_down_reconstruction (dc, dc->top_request); switch (dc->top_request->state) { @@ -1888,13 +1848,11 @@ GNUNET_FS_download_start_task_ (void *cls, if ((GNUNET_FS_uri_chk_get_file_size (dc->uri) <= MAX_INLINE_SIZE) && (NULL != dc->meta)) { -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to find embedded meta data for download of size %llu with %u bytes MD\n", (unsigned long long) GNUNET_FS_uri_chk_get_file_size (dc->uri), (unsigned int) GNUNET_CONTAINER_meta_data_get_serialized_size (dc->meta)); -#endif GNUNET_CONTAINER_meta_data_iterate (dc->meta, &match_full_data, dc); if (dc->top_request->state == BRS_DOWNLOAD_UP) { @@ -1911,10 +1869,8 @@ GNUNET_FS_download_start_task_ (void *cls, if (dc->rfh != NULL) { /* finally, try bottom-up */ -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying bottom-up reconstruction of file `%s'\n", dc->filename); -#endif dc->te = GNUNET_FS_tree_encoder_create (dc->h, dc->old_file_size, dc, &fh_reader, &reconstruct_cb, NULL, @@ -2041,10 +1997,8 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, GNUNET_break (0); return NULL; } -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting download `%s' of %llu bytes\n", filename, (unsigned long long) length); -#endif dc = GNUNET_malloc (sizeof (struct GNUNET_FS_DownloadContext)); dc->h = h; dc->parent = parent; @@ -2081,10 +2035,8 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, dc->temp_filename = GNUNET_DISK_mktemp ("gnunet-directory-download-tmp"); } -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download tree has depth %u\n", dc->treedepth); -#endif if (parent == NULL) { dc->top = @@ -2153,10 +2105,8 @@ GNUNET_FS_download_start_from_search (struct GNUNET_FS_Handle *h, GNUNET_break (0); return NULL; } -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting download `%s' of %llu bytes\n", filename, (unsigned long long) length); -#endif dc = GNUNET_malloc (sizeof (struct GNUNET_FS_DownloadContext)); dc->h = h; dc->search = sr; @@ -2195,10 +2145,8 @@ GNUNET_FS_download_start_from_search (struct GNUNET_FS_Handle *h, dc->temp_filename = GNUNET_DISK_mktemp ("gnunet-directory-download-tmp"); } -#if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Download tree has depth %u\n", dc->treedepth); -#endif dc->task = GNUNET_SCHEDULER_add_now (&GNUNET_FS_download_start_task_, dc); return dc; } diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index 2ac38ffd3..b3bbdc7b1 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c @@ -27,7 +27,6 @@ #include "platform.h" #include "fs_tree.h" -#define DEBUG_TREE GNUNET_EXTRA_LOGGING /** * Context for an ECRS-based file encoder that computes @@ -341,10 +340,8 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) if (te->chk_tree_depth == te->current_depth) { off = CHK_PER_INODE * (te->chk_tree_depth - 1); -#if DEBUG_TREE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TE done, reading CHK `%s' from %u\n", GNUNET_h2s (&te->chk_tree[off].query), off); -#endif te->uri = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri)); te->uri->type = chk; te->uri->data.chk.chk = te->chk_tree[off]; @@ -374,23 +371,19 @@ GNUNET_FS_tree_encoder_next (struct GNUNET_FS_TreeEncoder *te) pt_block = &te->chk_tree[(te->current_depth - 1) * CHK_PER_INODE]; } off = compute_chk_offset (te->current_depth, te->publish_offset); -#if DEBUG_TREE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TE is at offset %llu and depth %u with block size %u and target-CHK-offset %u\n", (unsigned long long) te->publish_offset, te->current_depth, (unsigned int) pt_size, (unsigned int) off); -#endif mychk = &te->chk_tree[te->current_depth * CHK_PER_INODE + off]; GNUNET_CRYPTO_hash (pt_block, pt_size, &mychk->key); GNUNET_CRYPTO_hash_to_aes_key (&mychk->key, &sk, &iv); GNUNET_CRYPTO_aes_encrypt (pt_block, pt_size, &sk, &iv, enc); GNUNET_CRYPTO_hash (enc, pt_size, &mychk->query); -#if DEBUG_TREE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "TE calculates query to be `%s', stored at %u\n", GNUNET_h2s (&mychk->query), te->current_depth * CHK_PER_INODE + off); -#endif if (NULL != te->proc) te->proc (te->cls, mychk, te->publish_offset, te->current_depth, (0 == diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index fa9147bcd..ff1996a2f 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c @@ -31,7 +31,6 @@ #include "fs_api.h" #include "fs_tree.h" -#define DEBUG_UNINDEX GNUNET_EXTRA_LOGGING /** * Function called by the tree encoder to obtain @@ -158,10 +157,8 @@ process_cont (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration signal_unindex_error (uc); return; } -#if DEBUG_UNINDEX GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Datastore REMOVE operation succeeded\n"); -#endif GNUNET_FS_tree_encoder_next (uc->tc); } @@ -202,10 +199,8 @@ unindex_process (void *cls, const struct ContentHashKey *chk, uint64_t offset, odb.file_id = uc->file_id; data = &odb; } -#if DEBUG_UNINDEX GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending REMOVE request to DATASTORE service\n"); -#endif GNUNET_DATASTORE_remove (uc->dsh, &chk->query, size, data, -2, 1, GNUNET_CONSTANTS_SERVICE_TIMEOUT, &process_cont, uc); } @@ -299,10 +294,8 @@ unindex_finish (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) signal_unindex_error (uc); return; } -#if DEBUG_UNINDEX GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending UNINDEX message to FS service\n"); -#endif req.header.size = htons (sizeof (struct UnindexMessage)); req.header.type = htons (GNUNET_MESSAGE_TYPE_FS_UNINDEX); req.reserved = 0; diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index cdf8f4325..06ac91c73 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -373,11 +373,9 @@ start_p2p_processing (void *cls, struct GSF_PendingRequest *pr, struct GSF_PendingRequestData *prd; prd = GSF_pending_request_get_data_ (pr); -#if DEBUG_FS_CLIENT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished database lookup for local request `%s' with result %d\n", GNUNET_h2s (&prd->query), result); -#endif GNUNET_SERVER_receive_done (client, GNUNET_OK); if (GNUNET_BLOCK_EVALUATION_OK_LAST == result) return; /* we're done, 'pr' was already destroyed... */ diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h index c669dcc7a..5ea73ee28 100644 --- a/src/fs/gnunet-service-fs.h +++ b/src/fs/gnunet-service-fs.h @@ -33,9 +33,6 @@ #include "gnunet_block_lib.h" #include "fs.h" -#define DEBUG_FS GNUNET_YES - -#define DEBUG_FS_CLIENT GNUNET_EXTRA_LOGGING /** * By which amount do we decrement the TTL for simple forwarding / diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 86986b899..e84993bd3 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c @@ -912,11 +912,9 @@ handle_p2p_reply (void *cls, enum GNUNET_BLOCK_EvaluationResult eval, 1, GNUNET_NO); return; } -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting result for query `%s' to peer\n", GNUNET_h2s (&prd->query)); -#endif GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# replies received for other peers"), 1, GNUNET_NO); @@ -1194,7 +1192,6 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, cp = cps; if (cp == NULL) { -#if DEBUG_FS if (0 != (bm & GET_MESSAGE_BIT_RETURN_TO)) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to find RETURN-TO peer `%4s' in connection set. Dropping query.\n", @@ -1205,7 +1202,6 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to find peer `%4s' in connection set. Dropping query.\n", GNUNET_i2s (other)); -#endif GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# requests dropped due to missing reverse route"), @@ -1218,19 +1214,15 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, priority = bound_priority (ntohl (gm->priority), cps); if (priority < 0) { -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Dropping query from `%s', this peer is too busy.\n", GNUNET_i2s (other)); -#endif return NULL; } -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received request for `%s' of type %u from peer `%4s' with flags %u\n", GNUNET_h2s (&gm->query), (unsigned int) type, GNUNET_i2s (other), (unsigned int) bm); -#endif namespace = (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE)) ? &opt[bits++] : NULL; if ((type == GNUNET_BLOCK_TYPE_FS_SBLOCK) && (namespace == NULL)) { @@ -1267,11 +1259,9 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, TTL_DECREMENT); if ((ttl < 0) && (((int32_t) (ttl - ttl_decrement)) > 0)) { -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Dropping query from `%s' due to TTL underflow (%d - %u).\n", GNUNET_i2s (other), ttl, ttl_decrement); -#endif GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# requests dropped due TTL underflow"), 1, @@ -1295,11 +1285,9 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, { /* existing request has higher TTL, drop new one! */ prd->priority += priority; -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Have existing request with higher TTL, dropping new request.\n", GNUNET_i2s (other)); -#endif GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# requests dropped due to higher-TTL request"), @@ -1352,10 +1340,8 @@ peer_transmit_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GSF_PeerTransmitHandle *pth = cls; struct GSF_ConnectedPeer *cp; -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Timeout trying to transmit to other peer\n"); -#endif pth->timeout_task = GNUNET_SCHEDULER_NO_TASK; cp = pth->cp; GNUNET_CONTAINER_DLL_remove (cp->pth_head, cp->pth_tail, pth); @@ -1717,19 +1703,15 @@ GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp, { if (cp->last_migration_block.abs_value > block_time.abs_value) { -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Migration already blocked for another %llu ms\n", (unsigned long long) GNUNET_TIME_absolute_get_remaining (cp->last_migration_block).rel_value); -#endif return; /* already blocked */ } -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %llu ms\n", (unsigned long long) GNUNET_TIME_absolute_get_remaining (block_time).rel_value); -#endif cp->last_migration_block = block_time; if (cp->migration_pth != NULL) GSF_peer_transmit_cancel_ (cp->migration_pth); diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c index d3aef8917..b56301962 100644 --- a/src/fs/gnunet-service-fs_indexing.c +++ b/src/fs/gnunet-service-fs_indexing.c @@ -265,10 +265,8 @@ hash_for_index_val (void *cls, const GNUNET_HashCode * res) _ ("Hash mismatch trying to index file `%s' which has hash `%s'\n"), ii->filename, GNUNET_h2s (res)); -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Wanted `%s'\n", GNUNET_h2s (&ii->file_id)); -#endif GNUNET_SERVER_transmit_context_append_data (ii->tc, NULL, 0, GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED); GNUNET_SERVER_transmit_context_run (ii->tc, GNUNET_TIME_UNIT_MINUTES); @@ -329,11 +327,8 @@ GNUNET_FS_handle_index_start (void *cls, struct GNUNET_SERVER_Client *client, ii->filename = (const char *) &ii[1]; memcpy (&ii[1], fn, slen); ii->file_id = ism->file_id; -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message for file `%s'\n", "START_INDEX", ii->filename); -#endif - ii->tc = GNUNET_SERVER_transmit_context_create (client); mydev = 0; myino = 0; @@ -346,12 +341,10 @@ GNUNET_FS_handle_index_start (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_free (fn); return; } -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Mismatch in file identifiers (%llu != %llu or %u != %u), need to hash.\n", (unsigned long long) ino, (unsigned long long) myino, (unsigned int) dev, (unsigned int) mydev); -#endif /* slow validation, need to hash full file (again) */ ii->fhc = GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_IDLE, fn, @@ -457,11 +450,9 @@ GNUNET_FS_handle_unindex (void *cls, struct GNUNET_SERVER_Client *client, } pos = next; } -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client requested unindexing of file `%s': %s\n", GNUNET_h2s (&um->file_id), found ? "found" : "not found"); -#endif if (GNUNET_YES == found) write_index_list (); tc = GNUNET_SERVER_transmit_context_create (client); @@ -583,10 +574,8 @@ GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key, uint32_t size, GNUNET_TIME_UNIT_FOREVER_REL, &remove_cont, NULL); return GNUNET_SYSERR; } -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "On-demand encoded block for query `%s'\n", GNUNET_h2s (key)); -#endif cont (cont_cls, key, nsize, edata, GNUNET_BLOCK_TYPE_FS_DBLOCK, priority, anonymity, expiration, uid); return GNUNET_OK; diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c index dcedd495a..36aafdde9 100644 --- a/src/fs/gnunet-service-fs_lc.c +++ b/src/fs/gnunet-service-fs_lc.c @@ -270,11 +270,9 @@ client_response_handler (void *cls, enum GNUNET_BLOCK_EvaluationResult eval, memcpy (&pm[1], data, data_len); GSF_local_client_transmit_ (lc, &pm->header); } -#if DEBUG_FS_CLIENT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Queued reply to query `%s' for local client\n", GNUNET_h2s (&prd->query), (unsigned int) prd->type); -#endif if (eval != GNUNET_BLOCK_EVALUATION_OK_LAST) return; if (GNUNET_SCHEDULER_NO_TASK != cr->kill_task) @@ -325,11 +323,9 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, sc = (msize - sizeof (struct SearchMessage)) / sizeof (GNUNET_HashCode); sm = (const struct SearchMessage *) message; type = ntohl (sm->type); -#if DEBUG_FS_CLIENT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received request for `%s' of type %u from local client\n", GNUNET_h2s (&sm->query), (unsigned int) type); -#endif lc = GSF_local_client_lookup_ (client); cr = NULL; /* detect duplicate KBLOCK requests */ @@ -352,10 +348,8 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, } if (cr != NULL) { -#if DEBUG_FS_CLIENT GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Have existing request, merging content-seen lists.\n"); -#endif GSF_pending_request_update_ (cr->pr, (const GNUNET_HashCode *) &sm[1], sc); GNUNET_STATISTICS_update (GSF_stats, gettext_noop diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index f1d87db01..71b0fc091 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c @@ -318,12 +318,9 @@ plan (struct PeerPlan *pp, struct GSF_RequestPlan *rp) (unsigned int) rp->transmission_counter, (unsigned long long) delay.rel_value); rp->earliest_transmission = GNUNET_TIME_relative_to_absolute (delay); -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Earliest (re)transmission for `%s' in %us\n", GNUNET_h2s (&prd->query), rp->transmission_counter); -#endif - GNUNET_assert (rp->hn == NULL); if (GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission).rel_value == 0) @@ -414,11 +411,9 @@ transmit_message_callback (void *cls, size_t buf_size, void *buf) rp->last_transmission = GNUNET_TIME_absolute_get (); rp->transmission_counter++; total_delay++; -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing plan %p executed %u times, planning retransmission\n", rp, rp->transmission_counter); -#endif plan (pp, rp); GNUNET_STATISTICS_update (GSF_stats, gettext_noop @@ -463,18 +458,14 @@ schedule_peer_transmission (void *cls, rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap); if (NULL == rp) { -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No active requests for plan %p.\n", pp); -#endif return; /* both queues empty */ } delay = GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission); -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sleeping for %llu ms before retrying requests on plan %p.\n", (unsigned long long) delay.rel_value, pp); -#endif GNUNET_STATISTICS_set (GSF_stats, gettext_noop ("# delay heap timeout"), delay.rel_value, GNUNET_NO); @@ -486,9 +477,7 @@ schedule_peer_transmission (void *cls, 1, GNUNET_NO); /* process from priority heap */ rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap); -#if DEBUG_FS > 1 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Executing query plan %p\n", rp); -#endif GNUNET_assert (NULL != rp); msize = GSF_pending_request_get_message_ (get_latest (rp), 0, NULL); pp->pth = @@ -608,11 +597,9 @@ GSF_plan_add_ (struct GSF_ConnectedPeer *cp, struct GSF_PendingRequest *pr) GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# query plan entries"), 1, GNUNET_NO); prd = GSF_pending_request_get_data_ (pr); -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Planning transmission of query `%s' to peer `%s'\n", GNUNET_h2s (&prd->query), GNUNET_i2s (&id)); -#endif rp = GNUNET_malloc (sizeof (struct GSF_RequestPlan)); rpr = GNUNET_malloc (sizeof (struct GSF_RequestPlanReference)); prl = GNUNET_malloc (sizeof (struct PendingRequestList)); diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index c16f94464..d4b448185 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -278,11 +278,9 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, struct GSF_PendingRequest *pr; struct GSF_PendingRequest *dpr; -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating request handle for `%s' of type %d\n", GNUNET_h2s (query), type); -#endif GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# Pending requests created"), 1, GNUNET_NO); @@ -489,12 +487,10 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr, int64_t ttl; int do_route; -#if DEBUG_FS if (buf_size > 0) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Building request message for `%s' of type %d\n", GNUNET_h2s (&pr->public_data.query), pr->public_data.type); -#endif k = 0; bm = 0; do_route = (0 == (pr->public_data.options & GSF_PRO_FORWARD_ONLY)); @@ -574,10 +570,8 @@ clean_request (void *cls, const GNUNET_HashCode * key, void *value) struct GSF_PendingRequest *pr = value; GSF_LocalLookupContinuation cont; -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up pending request for `%s'.\n", GNUNET_h2s (key)); -#endif if (NULL != (cont = pr->llc_cont)) { pr->llc_cont = NULL; @@ -778,11 +772,9 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value) if (NULL == pr->rh) return GNUNET_YES; -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Matched result (type %u) for query `%s' with pending request\n", (unsigned int) prq->type, GNUNET_h2s (key)); -#endif GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# replies received and matched"), 1, GNUNET_NO); @@ -815,10 +807,8 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value) gettext_noop ("# duplicate replies discarded (bloomfilter)"), 1, GNUNET_NO); -#if DEBUG_FS && 0 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Duplicate response `%s', discarding.\n", GNUNET_h2s (&mhash)); -#endif + "Duplicate response, discarding.\n"); return GNUNET_YES; /* duplicate */ case GNUNET_BLOCK_EVALUATION_RESULT_INVALID: return GNUNET_YES; /* wrong namespace */ @@ -838,11 +828,9 @@ process_reply (void *cls, const GNUNET_HashCode * key, void *value) GSF_pending_request_update_ (pr, &chash, 1); if (NULL == prq->sender) { -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found result for query `%s' in local datastore\n", GNUNET_h2s (key)); -#endif GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# results found locally"), 1, GNUNET_NO); @@ -940,11 +928,9 @@ put_migration_continuation (void *cls, int success, ppd = GSF_get_peer_performance_data_ (cp); if (min_expiration.abs_value > 0) { -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %llu ms because datastore is full\n", (unsigned long long) GNUNET_TIME_absolute_get_remaining (min_expiration).rel_value); -#endif GSF_block_peer_migration_ (cp, min_expiration); } else @@ -956,11 +942,9 @@ put_migration_continuation (void *cls, int success, mig_pause.rel_value = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, ppd->migration_delay.rel_value); ppd->migration_delay = GNUNET_TIME_relative_multiply (ppd->migration_delay, 2); -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Replicated content already exists locally, asking to stop migration for %llu ms\n", (unsigned long long) mig_pause.rel_value); -#endif GSF_block_peer_migration_ (cp, GNUNET_TIME_relative_to_absolute (mig_pause)); } } @@ -1042,11 +1026,9 @@ handle_dht_reply (void *cls, struct GNUNET_TIME_Absolute exp, if ((GNUNET_YES == active_to_migration) && (GNUNET_NO == test_put_load_too_high (prq.priority))) { -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Replicating result for query `%s' with priority %u\n", GNUNET_h2s (key), prq.priority); -#endif pmc = GNUNET_malloc (sizeof (struct PutMigrationContext)); pmc->start = GNUNET_TIME_absolute_get (); pmc->requested = GNUNET_YES; @@ -1220,10 +1202,8 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size, } if (NULL == key) { -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, "No further local responses available.\n"); -#endif if ((pr->public_data.type == GNUNET_BLOCK_TYPE_FS_DBLOCK) || (pr->public_data.type == GNUNET_BLOCK_TYPE_FS_IBLOCK)) GNUNET_STATISTICS_update (GSF_stats, @@ -1232,17 +1212,13 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size, GNUNET_NO); goto check_error_and_continue; } -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received reply for `%s' of type %d with UID %llu from datastore.\n", GNUNET_h2s (key), type, (unsigned long long) uid); -#endif if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND) { -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found ONDEMAND block, performing on-demand encoding\n"); -#endif GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# on-demand blocks matched requests"), 1, @@ -1356,9 +1332,7 @@ process_local_reply (void *cls, const GNUNET_HashCode * key, size_t size, ((GNUNET_YES == GSF_test_get_load_too_high_ (0)) || (pr->public_data.results_found > 5 + 2 * pr->public_data.priority))) { -#if DEBUG_FS > 2 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Load too high, done with request\n"); -#endif GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# Datastore lookups concluded (load too high)"), @@ -1557,11 +1531,9 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, if ((GNUNET_YES == active_to_migration) && (GNUNET_NO == test_put_load_too_high (prq.priority))) { -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Replicating result for query `%s' with priority %u\n", GNUNET_h2s (&query), prq.priority); -#endif pmc = GNUNET_malloc (sizeof (struct PutMigrationContext)); pmc->start = GNUNET_TIME_absolute_get (); pmc->requested = prq.request_found; @@ -1581,12 +1553,10 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, } else { -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Choosing not to keep content `%s' (%d/%d)\n", GNUNET_h2s (&query), active_to_migration, test_put_load_too_high (prq.priority)); -#endif } putl = GNUNET_LOAD_get_load (datastore_put_load); if ((NULL != (cp = prq.sender)) && (GNUNET_NO == prq.request_found) && @@ -1601,14 +1571,12 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, (unsigned int) (60000 * putl * putl))); -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %llu ms because of load %f and events %d/%d\n", (unsigned long long) block_time.rel_value, putl, active_to_migration, (GNUNET_NO == prq.request_found)); -#endif GSF_block_peer_migration_ (cp, GNUNET_TIME_relative_to_absolute (block_time)); } return GNUNET_OK; diff --git a/src/fs/gnunet-service-fs_push.c b/src/fs/gnunet-service-fs_push.c index 4fde823a1..22a76f332 100644 --- a/src/fs/gnunet-service-fs_push.c +++ b/src/fs/gnunet-service-fs_push.c @@ -31,8 +31,6 @@ #include "gnunet-service-fs_push.h" -#define DEBUG_FS_MIGRATION GNUNET_EXTRA_LOGGING - /** * Maximum number of blocks we keep in memory for migration. */ @@ -227,10 +225,8 @@ transmit_message (void *cls, size_t buf_size, void *buf) peer->msg = NULL; if (buf == NULL) { -#if DEBUG_FS_MIGRATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to migrate content to another peer (disconnect)\n"); -#endif GNUNET_free (msg); return 0; } @@ -238,10 +234,8 @@ transmit_message (void *cls, size_t buf_size, void *buf) GNUNET_assert (msize <= buf_size); memcpy (buf, msg, msize); GNUNET_free (msg); -#if DEBUG_FS_MIGRATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Pushing %u bytes to another peer\n", msize); -#endif find_content (peer); return msize; } @@ -292,10 +286,8 @@ transmit_content (struct MigrationReadyPeer *peer, { ret = GNUNET_NO; } -#if DEBUG_FS_MIGRATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking for transmission of %u bytes for migration\n", msize); -#endif peer->th = GSF_peer_transmit_ (peer->peer, GNUNET_NO, 0 /* priority */ , GNUNET_TIME_UNIT_FOREVER_REL, msize, &transmit_message, peer); @@ -390,16 +382,12 @@ find_content (struct MigrationReadyPeer *mrp) { if (mig_size < MAX_MIGRATION_QUEUE) { -#if DEBUG_FS_MIGRATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No content found for pushing, waiting for queue to fill\n"); -#endif return; /* will fill up eventually... */ } -#if DEBUG_FS_MIGRATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No suitable content found, purging content from full queue\n"); -#endif /* failed to find migration target AND * queue is full, purge most-forwarded * block from queue to make room for more */ @@ -419,10 +407,8 @@ find_content (struct MigrationReadyPeer *mrp) consider_gathering (); return; } -#if DEBUG_FS_MIGRATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Preparing to push best content to peer\n"); -#endif transmit_content (mrp, best); } @@ -459,10 +445,8 @@ consider_gathering () delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, mig_size); delay = GNUNET_TIME_relative_divide (delay, MAX_MIGRATION_QUEUE); delay = GNUNET_TIME_relative_max (delay, min_migration_delay); -#if DEBUG_FS_MIGRATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Scheduling gathering task (queue size: %u)\n", mig_size); -#endif mig_task = GNUNET_SCHEDULER_add_delayed (delay, &gather_migration_blocks, NULL); } @@ -494,9 +478,7 @@ process_migration_content (void *cls, const GNUNET_HashCode * key, size_t size, mig_qe = NULL; if (key == NULL) { -#if DEBUG_FS_MIGRATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No content found for migration...\n"); -#endif consider_gathering (); return; } @@ -516,11 +498,9 @@ process_migration_content (void *cls, const GNUNET_HashCode * key, size_t size, consider_gathering (); return; } -#if DEBUG_FS_MIGRATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Retrieved block `%s' of type %u for migration (queue size: %u/%u)\n", GNUNET_h2s (key), type, mig_size + 1, MAX_MIGRATION_QUEUE); -#endif mb = GNUNET_malloc (sizeof (struct MigrationReadyBlock) + size); mb->query = *key; mb->expiration = expiration; @@ -534,10 +514,8 @@ process_migration_content (void *cls, const GNUNET_HashCode * key, size_t size, { if (NULL == pos->th) { -#if DEBUG_FS_MIGRATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Preparing to push best content to peer\n"); -#endif if (GNUNET_YES == transmit_content (pos, mb)) break; /* 'mb' was freed! */ } @@ -563,11 +541,9 @@ gather_migration_blocks (void *cls, return; if (GSF_dsh != NULL) { -#if DEBUG_FS_MIGRATION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking datastore for content for replication (queue size: %u)\n", mig_size); -#endif mig_qe = GNUNET_DATASTORE_get_for_replication (GSF_dsh, 0, UINT_MAX, GNUNET_TIME_UNIT_FOREVER_REL, diff --git a/src/fs/gnunet-service-fs_put.c b/src/fs/gnunet-service-fs_put.c index fe6ebdbe4..3ac67136a 100644 --- a/src/fs/gnunet-service-fs_put.c +++ b/src/fs/gnunet-service-fs_put.c @@ -156,11 +156,9 @@ process_dht_put_content (void *cls, const GNUNET_HashCode * key, size_t size, } po->zero_anonymity_count_estimate = GNUNET_MAX (po->current_offset, po->zero_anonymity_count_estimate); -#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Retrieved block `%s' of type %u for DHT PUT\n", GNUNET_h2s (key), type); -#endif GNUNET_DHT_put (GSF_dht, key, 5 /* DEFAULT_PUT_REPLICATION */ , GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, type, size, data, expiration, GNUNET_TIME_UNIT_FOREVER_REL,