gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r20248 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r20248 - gnunet/src/fs
Date: Sun, 4 Mar 2012 22:07:31 +0100

Author: grothoff
Date: 2012-03-04 22:07:31 +0100 (Sun, 04 Mar 2012)
New Revision: 20248

Modified:
   gnunet/src/fs/fs_api.c
   gnunet/src/fs/fs_api.h
   gnunet/src/fs/fs_download.c
Log:
-add priorities to download queue

Modified: gnunet/src/fs/fs_api.c
===================================================================
--- gnunet/src/fs/fs_api.c      2012-03-04 21:00:26 UTC (rev 20247)
+++ gnunet/src/fs/fs_api.c      2012-03-04 21:07:31 UTC (rev 20248)
@@ -145,11 +145,13 @@
  * @param stop function to call to pause the job, or on dequeue (if the job 
was running)
  * @param cls closure for start and stop
  * @param blocks number of blocks this jobs uses
+ * @param priority how important is this download
  * @return queue handle
  */
 struct GNUNET_FS_QueueEntry *
 GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, GNUNET_FS_QueueStart start,
-                  GNUNET_FS_QueueStop stop, void *cls, unsigned int blocks)
+                  GNUNET_FS_QueueStop stop, void *cls, unsigned int blocks,
+                 enum GNUNET_FS_QueuePriority priority)
 {
   struct GNUNET_FS_QueueEntry *qe;
 
@@ -160,6 +162,7 @@
   qe->cls = cls;
   qe->queue_time = GNUNET_TIME_absolute_get ();
   qe->blocks = blocks;
+  qe->priority = priority;
   GNUNET_CONTAINER_DLL_insert_after (h->pending_head, h->pending_tail,
                                      h->pending_tail, qe);
   if (h->queue_job != GNUNET_SCHEDULER_NO_TASK)

Modified: gnunet/src/fs/fs_api.h
===================================================================
--- gnunet/src/fs/fs_api.h      2012-03-04 21:00:26 UTC (rev 20247)
+++ gnunet/src/fs/fs_api.h      2012-03-04 21:07:31 UTC (rev 20248)
@@ -417,7 +417,25 @@
 typedef void (*GNUNET_FS_QueueStop) (void *cls);
 
 
+
 /**
+ * Priorities for the queue.
+ */ 
+enum GNUNET_FS_QueuePriority
+  {
+    /**
+     * This is a probe (low priority).
+     */
+    GNUNET_FS_QUEUE_PRIORITY_PROBE,
+
+    /**
+     * Default priority.
+     */
+    GNUNET_FS_QUEUE_PRIORITY_NORMAL
+  };
+
+
+/**
  * Entry in the job queue.
  */
 struct GNUNET_FS_QueueEntry
@@ -479,6 +497,11 @@
   unsigned int blocks;
 
   /**
+   * How important is this download?
+   */
+  enum GNUNET_FS_QueuePriority priority;
+
+  /**
    * How often have we (re)started this download?
    */
   unsigned int start_times;
@@ -599,11 +622,13 @@
  * @param stop function to call to pause the job, or on dequeue (if the job 
was running)
  * @param cls closure for start and stop
  * @param blocks number of blocks this download has
+ * @param priority how important is this download
  * @return queue handle
  */
 struct GNUNET_FS_QueueEntry *
 GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, GNUNET_FS_QueueStart start,
-                  GNUNET_FS_QueueStop stop, void *cls, unsigned int blocks);
+                  GNUNET_FS_QueueStop stop, void *cls, unsigned int blocks,
+                 enum GNUNET_FS_QueuePriority priority);
 
 
 /**

Modified: gnunet/src/fs/fs_download.c
===================================================================
--- gnunet/src/fs/fs_download.c 2012-03-04 21:00:26 UTC (rev 20247)
+++ gnunet/src/fs/fs_download.c 2012-03-04 21:07:31 UTC (rev 20248)
@@ -2165,7 +2165,10 @@
   GNUNET_assert (dc->job_queue == NULL);
   dc->job_queue =
       GNUNET_FS_queue_ (dc->h, &activate_fs_download, &deactivate_fs_download,
-                        dc, (dc->length + DBLOCK_SIZE - 1) / DBLOCK_SIZE);
+                        dc, (dc->length + DBLOCK_SIZE - 1) / DBLOCK_SIZE,
+                       (0 == (dc->options & GNUNET_FS_DOWNLOAD_IS_PROBE))
+                       ? GNUNET_FS_QUEUE_PRIORITY_NORMAL 
+                       : GNUNET_FS_QUEUE_PRIORITY_PROBE);
 }
 
 




reply via email to

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