From: Christian Grothoff Date: Thu, 11 Mar 2010 13:36:21 +0000 (+0000) Subject: fix progress reporting X-Git-Tag: initial-import-from-subversion-38251~22509 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=547abb417ffdb39671758096ff0a843fa7f796f3;p=oweals%2Fgnunet.git fix progress reporting --- diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 7776f4b8b..7e5081f6e 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -36,7 +36,7 @@ #include "fs.h" #include "fs_tree.h" -#define DEBUG_DOWNLOAD GNUNET_YES +#define DEBUG_DOWNLOAD GNUNET_NO /** * We're storing the IBLOCKS after the @@ -152,6 +152,10 @@ make_download_status (struct GNUNET_FS_ProgressInfo *pi, = dc->completed; pi->value.download.anonymity = dc->anonymity; + pi->value.download.eta + = GNUNET_TIME_calculate_eta (dc->start_time, + dc->completed, + dc->length); } /** @@ -851,6 +855,7 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, dc->uri = GNUNET_FS_uri_dup (uri); dc->meta = GNUNET_CONTAINER_meta_data_duplicate (meta); dc->client_info = cctx; + dc->start_time = GNUNET_TIME_absolute_get (); if (NULL != filename) { dc->filename = GNUNET_strdup (filename); diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c index c865a3361..5279ce459 100644 --- a/src/fs/gnunet-download.c +++ b/src/fs/gnunet-download.c @@ -100,9 +100,9 @@ progress_cb (void *cls, break; case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: if (verbose) - { + { s = GNUNET_STRINGS_relative_time_to_string(info->value.download.eta); - t = GNUNET_STRINGS_byte_size_fancy(info->value.download.completed * 1000 / (info->value.download.duration.value + 1)); + t = GNUNET_STRINGS_byte_size_fancy(info->value.download.completed * 1000LL / (info->value.download.duration.value + 1)); fprintf (stdout, _("Downloading `%s' at %llu/%llu (%s remaining, %s/s)\n"), info->value.download.filename, diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 186e6483a..9c26ba28e 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_YES +#define DEBUG_FS GNUNET_NO /** * Maximum number of outgoing messages we queue per peer. diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c index f6fd3f664..37ef08ba5 100644 --- a/src/fs/gnunet-service-fs_indexing.c +++ b/src/fs/gnunet-service-fs_indexing.c @@ -248,7 +248,7 @@ signal_index_ok (struct IndexInfo *ii) GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _("Index request received for file `%s' is indexed as `%s'. Permitting anyway.\n"), + _("Index request received for file `%s' is already indexed as `%s'. Permitting anyway.\n"), ii->filename, (const char*) GNUNET_CONTAINER_multihashmap_get (ifm, &ii->file_id));