From 9f589c7d5e5df521c5fc99d51e876a6fdcd24fa1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 27 May 2010 12:15:12 +0000 Subject: [PATCH] logging, minor fixes --- src/fs/gnunet-service-fs.c | 28 +++++++++++++++++-- src/fs/test_gnunet_service_fs_migration.c | 8 +++--- ...test_gnunet_service_fs_migration_data.conf | 4 +-- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 7611f979c..5389255c4 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -44,7 +44,7 @@ #include "gnunet-service-fs_indexing.h" #include "fs.h" -#define DEBUG_FS GNUNET_NO +#define DEBUG_FS GNUNET_YES /** * Maximum number of outgoing messages we queue per peer. @@ -842,6 +842,11 @@ consider_migration (void *cls, } if (msize == 0) return GNUNET_YES; /* no content available */ + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Trying to migrate `%s' (%u bytes) to `%s'\n", + GNUNET_h2s (&mb->query), + msize, + GNUNET_i2s (&cppid)); cp->cth = GNUNET_CORE_notify_transmit_ready (core, 0, GNUNET_TIME_UNIT_FOREVER_REL, @@ -1500,9 +1505,26 @@ transmit_to_peer (void *cls, size -= sizeof (migm); memcpy (&cbuf[msize], &mb[1], mb->size); msize += mb->size; - size -= mb->size; + size -= mb->size; +#if DEBUG_FS + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Pushing migration block `%s' (%u bytes) to `%s'\n", + GNUNET_h2s (&mb->query), + mb->size, + GNUNET_i2s (&pid)); +#endif break; } + else + { +#if DEBUG_FS + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Migration block `%s' (%u bytes) is not on migration list for peer `%s'\n", + GNUNET_h2s (&mb->query), + mb->size, + GNUNET_i2s (&pid)); +#endif + } } if ( (mb->used_targets >= MIGRATION_TARGET_COUNT) || (mb->used_targets >= GNUNET_CONTAINER_multihashmap_size (connected_peers)) ) @@ -1515,7 +1537,7 @@ transmit_to_peer (void *cls, &pid.hashPubKey, cp); } -#if DEBUG_FS > 3 +#if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Transmitting %u bytes to peer %u\n", msize, diff --git a/src/fs/test_gnunet_service_fs_migration.c b/src/fs/test_gnunet_service_fs_migration.c index 94e959f14..9cf8c3773 100644 --- a/src/fs/test_gnunet_service_fs_migration.c +++ b/src/fs/test_gnunet_service_fs_migration.c @@ -37,12 +37,12 @@ /** * How long until we give up on transmitting the message? */ -#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600) +#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) /** * How long do we give the peers for content migration? */ -#define MIGRATION_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) +#define MIGRATION_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) #define SEED 42 @@ -236,7 +236,7 @@ main (int argc, char *argv[]) GNUNET_GETOPT_OPTION_END }; - GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); + GNUNET_DISK_directory_remove ("/tmp/test-gnunet-service-fs-migration/"); GNUNET_log_setup ("test_gnunet_service_fs_migration", #if VERBOSE "DEBUG", @@ -247,7 +247,7 @@ main (int argc, char *argv[]) GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx, "test-gnunet-service-fs-migration", "nohelp", options, &run, NULL); - GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-lib/"); + GNUNET_DISK_directory_remove ("/tmp/test-gnunet-service-fs-migration/"); return ok; } diff --git a/src/fs/test_gnunet_service_fs_migration_data.conf b/src/fs/test_gnunet_service_fs_migration_data.conf index f13ddad72..82606092c 100644 --- a/src/fs/test_gnunet_service_fs_migration_data.conf +++ b/src/fs/test_gnunet_service_fs_migration_data.conf @@ -42,7 +42,7 @@ HOSTNAME = localhost #TOTAL_QUOTA_OUT = 9321 TOTAL_QUOTA_IN = 3932160 TOTAL_QUOTA_OUT = 3932160 -#DEBUG = YES +DEBUG = YES #PREFIX = valgrind --tool=memcheck --leak-check=yes [fs] @@ -50,7 +50,7 @@ PORT = 43471 HOSTNAME = localhost #OPTIONS = -L DEBUG ACTIVEMIGRATION = YES -#DEBUG = YES +DEBUG = YES #PREFIX = valgrind --tool=memcheck --leak-check=yes #PREFIX = xterm -e gdb -x cmd --args -- 2.25.1