From e0a67acc314214d919e4800295b154f3494dc4b1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 15 Apr 2010 14:40:14 +0000 Subject: [PATCH] fix ttl underflow check --- src/fs/fs_download.c | 5 ++--- src/fs/fs_publish.c | 4 +--- src/fs/fs_tree.c | 7 +++---- src/fs/gnunet-service-fs.c | 6 +++--- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index b8e4de813..934f3567f 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -38,7 +38,7 @@ #include "fs.h" #include "fs_tree.h" -#define DEBUG_DOWNLOAD GNUNET_NO +#define DEBUG_DOWNLOAD GNUNET_YES /** * We're storing the IBLOCKS after the DBLOCKS on disk (so that we @@ -175,8 +175,7 @@ transmit_download_request (void *cls, /** - * Schedule the download of the specified - * block in the tree. + * Schedule the download of the specified block in the tree. * * @param dc overall download this block belongs to * @param chk content-hash-key of the block diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 0931b6829..79ffd1886 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -40,7 +40,7 @@ #include "fs.h" #include "fs_tree.h" -#define DEBUG_PUBLISH GNUNET_NO +#define DEBUG_PUBLISH GNUNET_YES /** * Main function that performs the upload. @@ -1080,8 +1080,6 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *sc) { if (GNUNET_SCHEDULER_NO_TASK != sc->upload_task) GNUNET_SCHEDULER_cancel (sc->h->sched, sc->upload_task); - else - GNUNET_assert (sc->all_done == GNUNET_YES); // FIXME: remove from persistence DB (?) --- think more about // shutdown / persistent-resume APIs!!! GNUNET_FS_file_information_inspect (sc->fi, diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index 07f78eea7..e8b1f469d 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c @@ -31,7 +31,7 @@ #include "platform.h" #include "fs_tree.h" -#define DEBUG_TREE GNUNET_NO +#define DEBUG_TREE GNUNET_YES /** * Context for an ECRS-based file encoder that computes @@ -257,9 +257,8 @@ compute_chk_offset (unsigned int height, /** - * Encrypt the next block of the file (and - * call proc and progress accordingly; or - * of course "cont" if we have already completed + * Encrypt the next block of the file (and call proc and progress + * accordingly; or of course "cont" if we have already completed * encoding of the entire file). * * @param te tree encoder to use diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index e0cd7d0dd..a18e3447f 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -48,7 +48,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. @@ -2689,7 +2689,7 @@ handle_p2p_get (void *cls, GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, TTL_DECREMENT); if ( (pr->ttl < 0) && - (pr->ttl - ttl_decrement > 0) ) + (((int32_t)(pr->ttl - ttl_decrement)) > 0) ) { #if DEBUG_FS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -2967,7 +2967,7 @@ handle_start_search (void *cls, &pr->mingle, &pr->bf_size, pr->replies_seen); - pr->query = sm->query; + pr->query = sm->query; switch (type) { case GNUNET_DATASTORE_BLOCKTYPE_DBLOCK: -- 2.25.1