From: Christian Grothoff Date: Tue, 19 Oct 2010 09:34:56 +0000 (+0000) Subject: fixes X-Git-Tag: initial-import-from-subversion-38251~20047 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bef20834523944b625a550e5a14ad94fbbcc6e6e;p=oweals%2Fgnunet.git fixes --- diff --git a/src/fs/fs_test_lib.c b/src/fs/fs_test_lib.c index b0776e736..dd646eafe 100644 --- a/src/fs/fs_test_lib.c +++ b/src/fs/fs_test_lib.c @@ -38,6 +38,12 @@ struct GNUNET_FS_TestDaemon { + /** + * Global configuration, only stored in first test daemon, + * otherwise NULL. + */ + struct GNUNET_CONFIGURATION_Handle *gcfg; + /** * Handle to the file sharing context using this daemon. */ @@ -140,15 +146,17 @@ struct GNUNET_FS_TestDaemon /** * Check whether peers successfully shut down. */ -void shutdown_callback (void *cls, - const char *emsg) +static void +shutdown_callback (void *cls, + const char *emsg) { + struct GNUNET_CONFIGURATION_Handle *gcfg = cls; + if (emsg != NULL) { -#if VERBOSE - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Shutdown of peers failed!\n"); -#endif + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Shutdown of peers failed: %s\n", + emsg); } else { @@ -157,8 +165,11 @@ void shutdown_callback (void *cls, "All peers successfully shut down!\n"); #endif } + if (gcfg != NULL) + GNUNET_CONFIGURATION_destroy (gcfg); } + static void report_uri (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -195,6 +206,7 @@ report_success (void *cls, daemon->download_sched = NULL; } + static void* progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) @@ -303,7 +315,7 @@ notify_running (void *cls, sctx->cont, sctx->cont_cls, GNUNET_SCHEDULER_REASON_PREREQ_DONE); - GNUNET_CONFIGURATION_destroy (sctx->cfg); + sctx->daemons[0]->gcfg = sctx->cfg; GNUNET_SCHEDULER_cancel (sctx->sched, sctx->timeout_task); for (i=0;itotal;i++) @@ -328,6 +340,8 @@ start_timeout (void *cls, struct StartContext *sctx = cls; unsigned int i; + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Timeout while trying to start daemons\n"); GNUNET_TESTING_daemons_stop (sctx->group, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30), &shutdown_callback, @@ -420,6 +434,7 @@ struct ConnectContext void *cont_cls; }; + /** * Prototype of a function that will be called whenever * two daemons are connected by the testing library. @@ -449,7 +464,7 @@ notify_connection (void *cls, if (emsg != NULL) GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _("Failed to connect peers: %s\n"), + "Failed to connect peers: %s\n", emsg); GNUNET_SCHEDULER_add_continuation (cc->sched, cc->cont, @@ -536,9 +551,11 @@ GNUNET_FS_TEST_daemons_stop (struct GNUNET_SCHEDULER_Handle *sched, { unsigned int i; struct GNUNET_TESTING_PeerGroup *pg; + struct GNUNET_CONFIGURATION_Handle *gcfg; GNUNET_assert (total > 0); pg = daemons[0]->group; + gcfg = daemons[0]->gcfg; for (i=0;ifs != NULL) @@ -548,7 +565,10 @@ GNUNET_FS_TEST_daemons_stop (struct GNUNET_SCHEDULER_Handle *sched, GNUNET_free (daemons[i]); daemons[i] = NULL; } - GNUNET_TESTING_daemons_stop (pg, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30), &shutdown_callback, NULL); + GNUNET_TESTING_daemons_stop (pg, + GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30), + &shutdown_callback, + gcfg); } @@ -558,7 +578,9 @@ publish_timeout (void *cls, { struct GNUNET_FS_TestDaemon *daemon = cls; GNUNET_FS_TEST_UriContinuation cont; - + + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Timeout while trying to publish data\n"); cont = daemon->publish_cont; daemon->publish_timeout_task = GNUNET_SCHEDULER_NO_TASK; daemon->publish_cont = NULL; @@ -581,6 +603,8 @@ file_generator (void *cls, uint8_t *cbuf = buf; int mod; + if (buf == NULL) + return 0; for (pos=0;pos<8;pos++) cbuf[pos] = (uint8_t) (offset >> pos*8); for (pos=8;posdownload_timeout_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_FS_download_stop (daemon->download_context, GNUNET_YES); daemon->download_context = NULL;