From f094448e150652facb82024f45dea7193650c2bc Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 25 Mar 2011 08:06:58 +0000 Subject: [PATCH] fixes --- src/fs/gnunet-service-fs.h | 2 ++ src/fs/gnunet-service-fs_cp.c | 4 +++- src/fs/gnunet-service-fs_indexing.c | 16 ++++------------ src/fs/gnunet-service-fs_indexing.h | 9 ++++++++- src/fs/gnunet-service-fs_lc.c | 1 + src/fs/gnunet-service-fs_new.c | 7 +++---- src/fs/gnunet-service-fs_pe.c | 1 + src/fs/gnunet-service-fs_pr.c | 3 ++- src/fs/test_fs_download_data.conf | 2 +- 9 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h index ee4cea8e2..c4a3d4bb9 100644 --- a/src/fs/gnunet-service-fs.h +++ b/src/fs/gnunet-service-fs.h @@ -33,6 +33,8 @@ #include "gnunet_block_lib.h" #include "fs.h" +#define DEBUG_FS GNUNET_YES + /** * Should we introduce random latency in processing? Required for proper diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 16ff566b2..c4e82350f 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c @@ -596,7 +596,7 @@ handle_p2p_reply (void *cls, #if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting result for query `%s'\n", - GNUNET_h2s (key)); + GNUNET_h2s (&prd->query)); #endif GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# replies received for other peers"), @@ -1636,6 +1636,8 @@ clean_local_client (void *cls, void GSF_handle_local_client_disconnect_ (const struct GSF_LocalClient *lc) { + if (NULL == cp_map) + return; /* already cleaned up */ GNUNET_CONTAINER_multihashmap_iterate (cp_map, &clean_local_client, (void*) lc); diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c index 363755169..cc99d3962 100644 --- a/src/fs/gnunet-service-fs_indexing.c +++ b/src/fs/gnunet-service-fs_indexing.c @@ -31,11 +31,10 @@ #include "gnunet_protocols.h" #include "gnunet_signatures.h" #include "gnunet_util_lib.h" +#include "gnunet-service-fs.h" #include "gnunet-service-fs_indexing.h" #include "fs.h" -#define DEBUG_FS GNUNET_NO - /** * In-memory information about indexed files (also available * on-disk). @@ -681,14 +680,10 @@ GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key, /** - * Task run during shutdown. - * - * @param cls unused - * @param tc unused + * Shutdown the module. */ -static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +void +GNUNET_FS_indexing_done () { struct IndexInfo *pos; @@ -718,9 +713,6 @@ GNUNET_FS_indexing_init (const struct GNUNET_CONFIGURATION_Handle *c, cfg = c; dsh = d; ifm = GNUNET_CONTAINER_multihashmap_create (128); - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, - &shutdown_task, - NULL); read_index_list (); return GNUNET_OK; } diff --git a/src/fs/gnunet-service-fs_indexing.h b/src/fs/gnunet-service-fs_indexing.h index e606f30b1..6a2c3d4a0 100644 --- a/src/fs/gnunet-service-fs_indexing.h +++ b/src/fs/gnunet-service-fs_indexing.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2009, 2010 Christian Grothoff (and other contributing authors) + (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -117,4 +117,11 @@ GNUNET_FS_indexing_init (const struct GNUNET_CONFIGURATION_Handle *c, struct GNUNET_DATASTORE_Handle *d); +/** + * Shutdown the module. + */ +void +GNUNET_FS_indexing_done (void); + + #endif diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c index 5242316d7..2b069d9ca 100644 --- a/src/fs/gnunet-service-fs_lc.c +++ b/src/fs/gnunet-service-fs_lc.c @@ -25,6 +25,7 @@ */ #include "platform.h" +#include "gnunet-service-fs.h" #include "gnunet-service-fs_lc.h" #include "gnunet-service-fs_cp.h" #include "gnunet-service-fs_pr.h" diff --git a/src/fs/gnunet-service-fs_new.c b/src/fs/gnunet-service-fs_new.c index 1eea28a9d..0f5931a19 100644 --- a/src/fs/gnunet-service-fs_new.c +++ b/src/fs/gnunet-service-fs_new.c @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2009, 2010 Christian Grothoff (and other contributing authors) + (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -28,7 +28,7 @@ * - GSF_plan_size_ (?) * - GSF_plan_notify_request_done (!) * - consider re-issue GSF_dht_lookup_ after non-DHT reply received - * + * - implement 'SUPPORT_DELAYS' * */ #include "platform.h" @@ -53,8 +53,6 @@ #include "gnunet-service-fs_put.h" #include "fs.h" -#define DEBUG_FS GNUNET_YES - /** * Size for the hash map for DHT requests from the FS * service. Should be about the number of concurrent @@ -416,6 +414,7 @@ shutdown_task (void *cls, GNUNET_SCHEDULER_cancel (cover_age_task); cover_age_task = GNUNET_SCHEDULER_NO_TASK; } + GNUNET_FS_indexing_done (); GNUNET_LOAD_value_free (datastore_get_load); datastore_get_load = NULL; GNUNET_LOAD_value_free (GSF_rt_entry_lifetime); diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index 00dd41f2a..fe6c995ed 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c @@ -24,6 +24,7 @@ * @author Christian Grothoff */ #include "platform.h" +#include "gnunet-service-fs.h" #include "gnunet-service-fs_cp.h" #include "gnunet-service-fs_pe.h" #include "gnunet-service-fs_pr.h" diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 2c983eaed..d8cd8716e 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -25,6 +25,7 @@ */ #include "platform.h" #include "gnunet_load_lib.h" +#include "gnunet-service-fs.h" #include "gnunet-service-fs_cp.h" #include "gnunet-service-fs_indexing.h" #include "gnunet-service-fs_pr.h" @@ -861,7 +862,7 @@ handle_dht_reply (void *cls, #if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Replicating result for query `%s' with priority %u\n", - GNUNET_h2s (&query), + GNUNET_h2s (key), prq.priority); #endif start = GNUNET_malloc (sizeof (struct GNUNET_TIME_Absolute)); diff --git a/src/fs/test_fs_download_data.conf b/src/fs/test_fs_download_data.conf index a1b202a4d..49389526d 100644 --- a/src/fs/test_fs_download_data.conf +++ b/src/fs/test_fs_download_data.conf @@ -37,7 +37,7 @@ HOSTNAME = localhost PORT = 42471 HOSTNAME = localhost ACTIVEMIGRATION = NO -DEBUG = NO +DEBUG = YES #PREFIX = valgrind --tool=memcheck --leak-check=yes #BINARY = /home/grothoff/bin/gnunet-service-fs -- 2.25.1