static void
start_job (struct GNUNET_FS_QueueEntry *qe)
{
- qe->client = GNUNET_CLIENT_connect (qe->h->sched, "fs", qe->h->cfg);
+ qe->client = GNUNET_CLIENT_connect ("fs", qe->h->cfg);
if (qe->client == NULL)
{
GNUNET_break (0);
continue;
stop_job (qe);
}
- h->queue_job = GNUNET_SCHEDULER_add_delayed (h->sched,
- restart_at,
+ h->queue_job = GNUNET_SCHEDULER_add_delayed (restart_at,
&process_job_queue,
h);
}
h->pending_tail,
qe);
if (h->queue_job != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (h->sched,
- h->queue_job);
+ GNUNET_SCHEDULER_cancel (h->queue_job);
h->queue_job
- = GNUNET_SCHEDULER_add_now (h->sched,
- &process_job_queue,
+ = GNUNET_SCHEDULER_add_now (&process_job_queue,
h);
return qe;
}
qh);
GNUNET_free (qh);
if (h->queue_job != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (h->sched,
- h->queue_job);
+ GNUNET_SCHEDULER_cancel (h->queue_job);
h->queue_job
- = GNUNET_SCHEDULER_add_now (h->sched,
- &process_job_queue,
+ = GNUNET_SCHEDULER_add_now (&process_job_queue,
h);
}
if ( (0 == (pc->options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) &&
(GNUNET_YES != pc->all_done) )
{
- pc->dsh = GNUNET_DATASTORE_connect (h->cfg,
- h->sched);
+ pc->dsh = GNUNET_DATASTORE_connect (h->cfg);
if (NULL == pc->dsh)
goto cleanup;
}
/* re-start publishing (if needed)... */
if (pc->all_done != GNUNET_YES)
pc->upload_task
- = GNUNET_SCHEDULER_add_with_priority (h->sched,
- GNUNET_SCHEDULER_PRIORITY_BACKGROUND,
+ = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_BACKGROUND,
&GNUNET_FS_publish_main_,
pc);
if (GNUNET_OK !=
(GNUNET_OK !=
GNUNET_BIO_write_int32 (wh, (uint32_t) dc->has_finished)) ||
(GNUNET_OK !=
- GNUNET_BIO_write_int32 (wh, num_pending)) )
+ GNUNET_BIO_write_int32 (wh, num_pending)) ||
+ (GNUNET_OK !=
+ GNUNET_BIO_write_int32 (wh, dc->start_task != GNUNET_SCHEDULER_NO_TASK)) )
{
GNUNET_break (0);
goto cleanup;
switch (uc->state)
{
case UNINDEX_STATE_HASHING:
- uc->fhc = GNUNET_CRYPTO_hash_file (uc->h->sched,
- GNUNET_SCHEDULER_PRIORITY_IDLE,
+ uc->fhc = GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_IDLE,
uc->filename,
HASHING_BLOCKSIZE,
&GNUNET_FS_unindex_process_hash_,
uint32_t options;
uint32_t status;
uint32_t num_pending;
+ int32_t start_pending;
uris = NULL;
emsg = NULL;
(GNUNET_OK !=
GNUNET_BIO_read_int32 (rh, &status)) ||
(GNUNET_OK !=
- GNUNET_BIO_read_int32 (rh, &num_pending)) )
+ GNUNET_BIO_read_int32 (rh, &num_pending)) ||
+ (GNUNET_OK !=
+ GNUNET_BIO_read_int32 (rh, &start_pending)) )
{
GNUNET_break (0);
goto cleanup;
signal_download_resume (dc);
}
GNUNET_free (uris);
+ if (start_pending)
+ dc->start_task
+ = GNUNET_SCHEDULER_add_now (&GNUNET_FS_download_start_task_, dc);
return;
cleanup:
GNUNET_free_non_null (uris);
/**
* Setup a connection to the file-sharing service.
*
- * @param sched scheduler to use
* @param cfg configuration to use
* @param client_name unique identifier for this client
* @param upcb function to call to notify about FS actions
* @return NULL on error
*/
struct GNUNET_FS_Handle *
-GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched,
- const struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_FS_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *client_name,
GNUNET_FS_ProgressCallback upcb,
void *upcb_cls,
va_list ap;
ret = GNUNET_malloc (sizeof (struct GNUNET_FS_Handle));
- ret->sched = sched;
ret->cfg = cfg;
ret->client_name = GNUNET_strdup (client_name);
ret->upcb = upcb;
while (h->top_head != NULL)
h->top_head->ssf (h->top_head->ssf_cls);
if (h->queue_job != GNUNET_SCHEDULER_NO_TASK)
- GNUNET_SCHEDULER_cancel (h->sched,
- h->queue_job);
+ GNUNET_SCHEDULER_cancel (h->queue_job);
GNUNET_free (h->client_name);
GNUNET_free (h);
}