* @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;
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)
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.
*/
*/
unsigned int blocks;
+ /**
+ * How important is this download?
+ */
+ enum GNUNET_FS_QueuePriority priority;
+
/**
* How often have we (re)started this download?
*/
* @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);
/**
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);
}