fix progress reporting
authorChristian Grothoff <christian@grothoff.org>
Thu, 11 Mar 2010 13:36:21 +0000 (13:36 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 11 Mar 2010 13:36:21 +0000 (13:36 +0000)
src/fs/fs_download.c
src/fs/gnunet-download.c
src/fs/gnunet-service-fs.c
src/fs/gnunet-service-fs_indexing.c

index 7776f4b8bf8cd9cfa6873294bff5f527423c2b83..7e5081f6e8ad092c4b4d5c8bc115d809f5b04e00 100644 (file)
@@ -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);
index c865a33619a55e480dadb05df2d598ce3dcab81d..5279ce459099678cb661bb4e6582545436479bce 100644 (file)
@@ -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,
index 186e6483afb3ec715529998f4a395bd6eef8d5ab..9c26ba28e4a558a073331e457e83c8d17dd4a765 100644 (file)
@@ -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.
index f6fd3f664e21ecd7b4387face8b0ccc3898e01f4..37ef08ba5c6610d341469073f5d431c048f0ed90 100644 (file)
@@ -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));