gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7443 - GNUnet/src/applications/fs/fsui


From: gnunet
Subject: [GNUnet-SVN] r7443 - GNUnet/src/applications/fs/fsui
Date: Wed, 16 Jul 2008 23:53:45 -0600 (MDT)

Author: grothoff
Date: 2008-07-16 23:53:45 -0600 (Wed, 16 Jul 2008)
New Revision: 7443

Modified:
   GNUnet/src/applications/fs/fsui/download.c
   GNUnet/src/applications/fs/fsui/fsui.c
   GNUnet/src/applications/fs/fsui/fsui.h
Log:
even better fix for 1387

Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c  2008-07-17 05:42:30 UTC (rev 
7442)
+++ GNUnet/src/applications/fs/fsui/download.c  2008-07-17 05:53:45 UTC (rev 
7443)
@@ -453,7 +453,6 @@
   if (list == NULL)
     return GNUNET_NO;
   ectx = list->ctx->ectx;
-
 #if DEBUG_DTM
   GNUNET_GE_LOG (ectx,
                  GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
@@ -467,10 +466,14 @@
   if ((list->ctx->threadPoolSize
        > list->ctx->activeDownloadThreads) &&
       (list->state == GNUNET_FSUI_PENDING) &&
-      ( (list->block_resume < now) ||
+      ( (list->block_resume == 0) ||
+       (list->block_resume == list->ctx->min_block_resume) ||
        (list->ctx->threadPoolSize > list->ctx->activeDownloadThreads + 1) ) &&
       ((list->total > list->completed) || (list->total == 0)))
     {
+      if (list->block_resume == list->ctx->min_block_resume)
+       list->ctx->min_block_resume = -1;       
+      list->block_resume = 0;
 #if DEBUG_DTM
       GNUNET_GE_LOG (ectx,
                      GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
@@ -509,7 +512,7 @@
     {
       if ( (list->ctx->threadPoolSize == list->ctx->activeDownloadThreads) &&
           (0 == (list->progressBits & GNUNET_FSUI_DL_KILL_TIME_MASK)) )
-       list->block_resume = now + GNUNET_FSUI_DL_KILL_PERIOD;  
+       list->block_resume = now;
       else
        list->block_resume = 0;
 #if DEBUG_DTM
@@ -588,6 +591,10 @@
         ret = GNUNET_YES;
       dpos = dpos->next;
     }
+  if ( (list->block_resume != 0) &&
+       (list->state == GNUNET_FSUI_PENDING) &&
+       (list->block_resume < list->ctx->next_min_block_resume) )
+    list->ctx->next_min_block_resume = list->block_resume;
   return ret;
 }
 

Modified: GNUnet/src/applications/fs/fsui/fsui.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.c      2008-07-17 05:42:30 UTC (rev 
7442)
+++ GNUnet/src/applications/fs/fsui/fsui.c      2008-07-17 05:53:45 UTC (rev 
7443)
@@ -85,11 +85,13 @@
                    GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
                    "Download thread manager schedules pending downloads...\n");
 #endif
+  ctx->next_min_block_resume = -1;
   while (dpos != NULL)
     {
       GNUNET_FSUI_updateDownloadThread (dpos);
       dpos = dpos->next;
     }
+  ctx->min_block_resume = ctx->next_min_block_resume;
   now = GNUNET_get_time ();
   sl = ctx->activeSearches;
   while (sl != NULL)

Modified: GNUnet/src/applications/fs/fsui/fsui.h
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.h      2008-07-17 05:42:30 UTC (rev 
7442)
+++ GNUnet/src/applications/fs/fsui/fsui.h      2008-07-17 05:53:45 UTC (rev 
7443)
@@ -70,15 +70,6 @@
 #define GNUNET_FSUI_DL_KILL_TIME_MASK 0x7FFF
 
 /**
- * If a download was paused because it failed
- * to make any progress and because other downloads
- * were pending, how long until we may try it again
- * (assuming that our download queues continue to
- * be entirely filled the whole time)?
- */
-#define GNUNET_FSUI_DL_KILL_PERIOD (6 * GNUNET_CRON_HOURS)
-
-/**
  * Track record for a given result.
  */
 struct SearchResultList
@@ -348,7 +339,7 @@
   GNUNET_CronTime lastProgressTime;
 
   /**
-   * How long is this thread blocked from resuming if
+   * When was this thread blocked from resuming if
    * all download queues are busy? (only
    * valid if the thread state is FSUI_PENDING).
    */
@@ -515,6 +506,19 @@
 typedef struct GNUNET_FSUI_Context
 {
 
+  /**
+   * What is the minimum, non-zero block_resume value of
+   * any download? (updated in each iteration over
+   * all downloads).
+   */
+  GNUNET_CronTime min_block_resume;
+
+  /**
+   * Running value in this iteration of the update
+   * for min_block_resume.
+   */
+  GNUNET_CronTime next_min_block_resume;
+
   struct GNUNET_GE_Context *ectx;
 
   struct GNUNET_GC_Configuration *cfg;





reply via email to

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