gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r152 - in GNUnet: . src/applications/fs/ecrs src/applicatio


From: grothoff
Subject: [GNUnet-SVN] r152 - in GNUnet: . src/applications/fs/ecrs src/applications/fs/fsui
Date: Wed, 2 Feb 2005 00:21:25 -0800 (PST)

Author: grothoff
Date: 2005-02-02 00:21:24 -0800 (Wed, 02 Feb 2005)
New Revision: 152

Modified:
   GNUnet/src/applications/fs/ecrs/download.c
   GNUnet/src/applications/fs/ecrs/upload.c
   GNUnet/src/applications/fs/fsui/download.c
   GNUnet/src/applications/fs/fsui/upload.c
   GNUnet/todo
Log:
more ETA computations

Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c  2005-02-02 07:12:46 UTC (rev 
151)
+++ GNUnet/src/applications/fs/ecrs/download.c  2005-02-02 08:21:24 UTC (rev 
152)
@@ -21,16 +21,6 @@
  * @file applications/fs/ecrs/download.c
  * @brief Download helper methods (which do the real work).
  * @author Christian Grothoff
- *
- * TODO:
- * - eta estimate
- * - currently, code checks for duplicates to do
- *   congestion control, but it can never be notified
- *   about duplicates!
- * - average priority needs to be tracked / obtained
- *   to adjust outgoing priorities 
- * - we keep less stats than we used to, and they are
- *   not all properly updated
  */
 
 #include "platform.h"
@@ -534,7 +524,6 @@
       if (NULL != rm->requestList[i]->searchHandle)
        FS_stop_search(rm->sctx,
                       rm->requestList[i]->searchHandle);
-      /* FIXME: update stat: currentRetires */
       FREE(rm->requestList[i]);
       rm->requestList[i] 
        = rm->requestList[--rm->requestListIndex];
@@ -611,7 +600,12 @@
     cron_t eta;
 
     node->ctx->completed += size;
-    eta = 0; /* FIXME */
+    cronTime(&eta); /* now */
+    if (node->ctx->completed > 0) {
+      eta = (cron_t) (node->ctx->startTime +
+                     (((double)(eta - 
node->ctx->startTime)/(double)node->ctx->completed)) 
+                     * (double)node->ctx->total);
+    } 
     node->ctx->dpcb(node->ctx->total,
                    node->ctx->completed,
                    eta,
@@ -629,25 +623,8 @@
   for (i=0;i<rm->requestListIndex;i++) 
     if (rm->requestList[i]->node == node)
       pos = i;
-  if (pos == -1) { /* FIXME: this can currently never happen,
-                     since after the first reply we unregister
-                     with gnunetd, so we'll never see dupes here! */
-    TIME_T nowTT;
-
-    TIME(&nowTT);
-    if ( (nowTT - rm->initialTTL) > rm->lastDET) {
-      /* only consider congestion control every
-        "average" TTL seconds, otherwise the system
-        reacts to events that are far too old! */
-
-      /* duplicate reply, treat as congestion (RFC 2001) */
-      rm->ssthresh = rm->congestionWindow / 2;
-      if (rm->ssthresh < 2)
-       rm->ssthresh = 2;
-      rm->congestionWindow 
-       = rm->ssthresh + 1;
-      rm->lastDET = nowTT;
-    } 
+  if (pos == -1) {
+    /* BREAK(); */ /* should never happen */
     return;
   }
   entry = rm->requestList[pos];
@@ -689,8 +666,6 @@
        = rm->ssthresh + 1;
       rm->lastDET = nowTT;
     }
-    /* cur->nc->stats.totalRetries += entry->tries-1;
-       cur->nc->stats.currentRetries -= (entry->tries - 1); */
   }
 }
 
@@ -900,6 +875,8 @@
   unsigned int type;
   unsigned int ttl;
   int TTL_DECREMENT;
+  static unsigned int lastmpriority;
+  static cron_t lastmpritime;
 
   cronTime(&now);
   entry = rm->requestList[requestIndex];
@@ -908,7 +885,17 @@
                   entry->searchHandle);
 
   /* compute priority */
-  mpriority = 42; /* FIXME: get current avg. priority here! */
+  if (lastmpritime + 10 * cronSECONDS < now) {
+    /* only update avg. priority at most every
+       10 seconds */
+    GNUNET_TCP_SOCKET * sock;
+
+    sock = getClientSocket();
+    lastmpriority = FS_getAveragePriority(sock);
+    lastmpritime = now;
+    releaseClientSocket(sock);    
+  }
+  mpriority = lastmpriority;
   priority
     = entry->lastPriority + randomi(1 + entry->tries);
   if (priority > mpriority) {

Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c    2005-02-02 07:12:46 UTC (rev 
151)
+++ GNUnet/src/applications/fs/ecrs/upload.c    2005-02-02 08:21:24 UTC (rev 
152)
@@ -319,9 +319,11 @@
     }
     pos += size;
     cronTime(&now);
-    eta = (cron_t) (start +
-                   (((double)(now - start)/(double)pos)) 
-                   * (double)filesize);
+    if (pos > 0) {
+      eta = (cron_t) (start +
+                     (((double)(now - start)/(double)pos)) 
+                     * (double)filesize);
+    }
   }
   if (tt != NULL)
     if (OK != tt(ttClosure))

Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c  2005-02-02 07:12:46 UTC (rev 
151)
+++ GNUnet/src/applications/fs/fsui/download.c  2005-02-02 08:21:24 UTC (rev 
152)
@@ -416,7 +416,7 @@
  * Abort a recursive download (internal function).
  * 
  * FIXME: dirname is currently not used, which means
- * that we may abor the wrong download (if there are
+ * that we may abort the wrong download (if there are
  * multiple downloads for the same uri!).
  *
  * Do NOT call cleanupFSUIThreadList in here -- this

Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c    2005-02-02 07:12:46 UTC (rev 
151)
+++ GNUnet/src/applications/fs/fsui/upload.c    2005-02-02 08:21:24 UTC (rev 
152)
@@ -23,11 +23,6 @@
  * @brief upload functions
  * @author Krista Bennett
  * @author Christian Grothoff
- *
- * TODO:
- * - add ETA computations
- * - test
- * - integrate with URI tracking (file_info::FSUI_trackURI)
  */
 
 #include "platform.h"
@@ -87,8 +82,15 @@
   event.data.UploadProgress.start_time = utc->start_time;
   event.data.UploadProgress.main_completed = utc->main_completed + 
completedBytes;
   event.data.UploadProgress.main_total = utc->main_total;
-  event.data.UploadProgress.eta = 0; /* FIXME! */
-  event.data.UploadProgress.main_eta = 0; /* FIXME! */
+  event.data.UploadProgress.eta = eta; 
+  if (totalBytes > 0) {
+    event.data.UploadProgress.main_eta 
+      = (cron_t) (utc->start_time +
+                 (((double)(now - 
utc->start_time/(double)(utc->main_completed+completedBytes))))
+                  * (double)utc->main_total);
+  } else {
+    event.data.UploadProgress.main_eta = eta; /* huh? */
+  }
   utc->ctx->ecb(utc->ctx->ecbClosure,
                &event);
 } 
@@ -163,7 +165,11 @@
        event.data.UploadComplete.total = utc->main_total;
        event.data.UploadComplete.filename = utc->filename;
        event.data.UploadComplete.uri = *uri;
-       event.data.UploadComplete.eta = 42; /* FIXME! */
+       event.data.UploadComplete.eta 
+         = (cron_t) (utc->start_time +
+                     (((double)(cronTime(NULL) 
+                                - 
utc->start_time/(double)(utc->main_completed+len))))
+                     * (double)utc->main_total);
        event.data.UploadComplete.start_time = utc->start_time;
        event.data.UploadComplete.is_recursive = YES;
        event.data.UploadComplete.main_filename = utc->main_filename;
@@ -226,13 +232,17 @@
     event.data.UploadComplete.total = utc->main_total;
     event.data.UploadComplete.filename = utc->filename;
     event.data.UploadComplete.uri = uri;
-    event.data.UploadComplete.eta = 42; /* FIXME! */
+    utc->main_completed += getFileSize(fn);
+    event.data.UploadComplete.eta 
+      = (cron_t) (utc->start_time +
+                 (((double)(cronTime(NULL) 
+                            - utc->start_time/(double)(utc->main_completed))))
+                 * (double)utc->main_total);
     event.data.UploadComplete.start_time = utc->start_time;
     event.data.UploadComplete.is_recursive = YES;
     event.data.UploadComplete.main_filename = utc->main_filename;
     utc->ctx->ecb(utc->ctx->ecbClosure,
                  &event);      
-    utc->main_completed += getFileSize(fn);
     meta = ECRS_createMetaData();
     ECRS_extractMetaData(meta,
                         fn,
@@ -247,8 +257,7 @@
                          &uri,
                          &meta);
   }
-  if (ret == OK) {
-    
+  if (ret == OK) {   
     ECRS_addToMetaData(meta,
                       EXTRACTOR_FILENAME,
                       filename);
@@ -275,6 +284,7 @@
         utc->dir.fiCount+1);
     utc->dir.fis[utc->dir.fiCount-1].meta = meta;    
     utc->dir.fis[utc->dir.fiCount-1].uri = uri;
+    FSUI_trackURI(&utc->dir.fis[utc->dir.fiCount-1]);
   }
   FREE(fn);
 }
@@ -286,6 +296,7 @@
   struct ECRS_URI * uri;
   struct ECRS_URI * keywordUri;
   FSUI_Event event;
+  ECRS_FileInfo fi;
   int ret;
   char * inboundFN;
 
@@ -359,6 +370,9 @@
     event.data.message = _("Cannot upload directory without using 
recursion.\n");
   }
   if (ret == OK) { /* publish top-level advertisements */
+    fi.meta = utc->meta;
+    fi.uri = uri;
+    FSUI_trackURI(&fi);
     if (inboundFN != NULL) {
       ECRS_delFromMetaData(utc->meta,
                           EXTRACTOR_FILENAME,

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-02-02 07:12:46 UTC (rev 151)
+++ GNUnet/todo 2005-02-02 08:21:24 UTC (rev 152)
@@ -7,11 +7,10 @@
 - 704?
 - 593???
 
-0.7.0pre0 [4'05] (aka "pre-preview"):
+0.7.0pre0 [3'05] (aka "pre-preview"):
 - Missing Features:
-  * fsui upload: ETA calculations, tracking URIs
-  * ecrs-download: some stats, some details in the heuristics
   * fsui core (persistence, shutdown, multiple FSUIs)
+  * mysql sqstore implementation iterator problem (Igor?)
 - Need testing:
   * ECRS-directories (build, iterate)
   * FS/ECRS upload/download
@@ -19,7 +18,8 @@
   * gnunet-pseudonym
   * gnunet-search
 
-0.7.0pre1 [5'05] (aka "preview"):
+0.7.0pre1 [4'05] (aka "preview"):
+- sqlite sqstore implementation does not compile yet (Nils)
 - gnunet-insert:
   * allow any kind of meta-data to be specified on the
     command-line
@@ -30,17 +30,17 @@
   * implement GetAvgPriority (fs.c)
   * DHT integration (fs.c)
 - FSUI:
+  * download: various details wrt generated events
   * namespace updates
   * collections
 
-0.7.0 [6'05] (aka "compatibility? what's that?"):
+0.7.0 [5'05] (aka "compatibility? what's that?"):
 - Missing Features:
   * topology: do aggressive bootstrap on first start (Christian)
   * ecrs-unindex: code cleanup
   * fix dht routing service
      - make dht respect new dht API (long way to go)
      - fs-dht integration
-  * sqlite sqstore implementation does not compile yet (Nils)
   * configure.ac: flags for mysql, gmp, libgcrypt should ONLY be passed when
     linking the respective modules / libraries (gnunet_util, sqstore_mysql)
 - Features removed but to be revived:





reply via email to

[Prev in Thread] Current Thread [Next in Thread]