static void
do_reconnect (void *cls)
{
- GNUNET_MQ_hd_var_size (put,
- GNUNET_MESSAGE_TYPE_FS_PUT,
- struct ClientPutMessage);
struct GNUNET_FS_DownloadContext *dc = cls;
struct GNUNET_MQ_MessageHandler handlers[] = {
- make_put_handler (dc),
+ GNUNET_MQ_hd_var_size (put,
+ GNUNET_MESSAGE_TYPE_FS_PUT,
+ struct ClientPutMessage,
+ dc),
GNUNET_MQ_handler_end ()
};
dc->task = NULL;
- dc->mq = GNUNET_CLIENT_connecT (dc->h->cfg,
+ dc->mq = GNUNET_CLIENT_connect (dc->h->cfg,
"fs",
handlers,
&download_mq_error_handler,
static void
try_reconnect (struct GNUNET_FS_DownloadContext *dc)
{
-
if (NULL != dc->mq)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Will try to reconnect in %s\n",
GNUNET_STRINGS_relative_time_to_string (dc->reconnect_backoff,
GNUNET_YES));
+ GNUNET_break (NULL != dc->job_queue);
dc->task =
GNUNET_SCHEDULER_add_delayed (dc->reconnect_backoff,
&do_reconnect,
struct GNUNET_FS_DownloadContext *dc = cls;
/* clean up state from tree encoder */
- if (dc->task != NULL)
+ if (NULL != dc->task)
{
GNUNET_SCHEDULER_cancel (dc->task);
dc->task = NULL;
* @param block_size size of block (in bytes)
*/
static void
-reconstruct_cb (void *cls, const struct ContentHashKey *chk, uint64_t offset,
- unsigned int depth, enum GNUNET_BLOCK_Type type,
- const void *block, uint16_t block_size)
+reconstruct_cb (void *cls,
+ const struct ContentHashKey *chk,
+ uint64_t offset,
+ unsigned int depth,
+ enum GNUNET_BLOCK_Type type,
+ const void *block,
+ uint16_t block_size)
{
struct GNUNET_FS_DownloadContext *dc = cls;
struct GNUNET_FS_ProgressInfo pi;
"Block %u < %u irrelevant for our range\n",
chld,
dr->children[0]->chk_idx);
- dc->task = GNUNET_SCHEDULER_add_now (&get_next_block, dc);
+ dc->task = GNUNET_SCHEDULER_add_now (&get_next_block,
+ dc);
return; /* irrelevant block */
}
if (chld > dr->children[dr->num_children-1]->chk_idx)
GNUNET_assert (0);
break;
}
- dc->task = GNUNET_SCHEDULER_add_now (&get_next_block, dc);
- if ((dr == dc->top_request) && (dr->state == BRS_DOWNLOAD_UP))
+ dc->task = GNUNET_SCHEDULER_add_now (&get_next_block,
+ dc);
+ if ( (dr == dc->top_request) &&
+ (dr->state == BRS_DOWNLOAD_UP) )
check_completed (dc);
}
&reconstruct_cb,
NULL,
&reconstruct_cont);
- dc->task = GNUNET_SCHEDULER_add_now (&get_next_block, dc);
+ dc->task = GNUNET_SCHEDULER_add_now (&get_next_block,
+ dc);
}
else
{
filename,
(unsigned long long) length,
dc->treedepth);
+ GNUNET_assert (NULL == dc->job_queue);
dc->task = GNUNET_SCHEDULER_add_now (&GNUNET_FS_download_start_task_,
dc);
return dc;
if (NULL != dc->mq)
return; /* already running */
GNUNET_assert (NULL == dc->job_queue);
+ GNUNET_assert (NULL == dc->task);
GNUNET_assert (NULL != dc->active);
- dc->job_queue =
- GNUNET_FS_queue_ (dc->h,
+ dc->job_queue
+ = GNUNET_FS_queue_ (dc->h,
&activate_fs_download,
&deactivate_fs_download,
dc,
pi.status = GNUNET_FS_STATUS_DOWNLOAD_ACTIVE;
GNUNET_FS_download_make_status_ (&pi, dc);
- dc->job_queue =
- GNUNET_FS_queue_ (dc->h,
- &activate_fs_download,
- &deactivate_fs_download,
- 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);
+ GNUNET_assert (NULL == dc->task);
+ dc->job_queue
+ = GNUNET_FS_queue_ (dc->h,
+ &activate_fs_download,
+ &deactivate_fs_download,
+ 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);
}