}
+#define GNUNET_FS_URI_CHK_PREFIX GNUNET_FS_URI_PREFIX GNUNET_FS_URI_CHK_INFIX
+
/**
* We found an entry in a directory. Check if the respective child
* already exists and if not create the respective child download.
if (fn == NULL)
{
us = GNUNET_FS_uri_to_string (uri);
- fn = GNUNET_strdup (&us [strlen (GNUNET_FS_URI_PREFIX
- GNUNET_FS_URI_CHK_INFIX)]);
+ fn = GNUNET_strdup (&us [strlen (GNUNET_FS_URI_CHK_PREFIX)]);
GNUNET_free (us);
}
else if (fn[0] == '.')
us = GNUNET_FS_uri_to_string (uri);
GNUNET_asprintf (&fn,
"%s%s",
- &us[strlen (GNUNET_FS_URI_PREFIX
- GNUNET_FS_URI_CHK_INFIX)], ext);
+ &us[strlen (GNUNET_FS_URI_CHK_PREFIX)], ext);
GNUNET_free (ext);
GNUNET_free (us);
}
struct GNUNET_CLIENT_Connection *client;
dc->task = GNUNET_SCHEDULER_NO_TASK;
- client = GNUNET_CLIENT_connect (dc->h->sched,
- "fs",
+ client = GNUNET_CLIENT_connect ("fs",
dc->h->cfg);
if (NULL == client)
{
"Will try to reconnect in 1s\n");
#endif
dc->task
- = GNUNET_SCHEDULER_add_delayed (dc->h->sched,
- GNUNET_TIME_UNIT_SECONDS,
+ = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
&do_reconnect,
dc);
}
pi.status = GNUNET_FS_STATUS_DOWNLOAD_SUSPEND;
GNUNET_FS_download_make_status_ (&pi, dc);
if (GNUNET_SCHEDULER_NO_TASK != dc->task)
- GNUNET_SCHEDULER_cancel (dc->h->sched,
- dc->task);
+ GNUNET_SCHEDULER_cancel (dc->task);
GNUNET_CONTAINER_multihashmap_iterate (dc->active,
&free_entry,
NULL);
struct GNUNET_FS_ProgressInfo pi;
struct GNUNET_FS_DownloadContext *dc;
- GNUNET_assert (GNUNET_FS_uri_test_chk (uri));
+ GNUNET_assert (GNUNET_FS_uri_test_chk (uri) ||
+ GNUNET_FS_uri_test_loc (uri) );
+
if ( (offset + length < offset) ||
- (offset + length > uri->data.chk.file_length) )
+ (offset + length > GNUNET_FS_uri_chk_get_file_size (uri)) )
{
GNUNET_break (0);
return NULL;
dc->anonymity = anonymity;
dc->options = options;
dc->active = GNUNET_CONTAINER_multihashmap_create (1 + 2 * (length / DBLOCK_SIZE));
- dc->treedepth = GNUNET_FS_compute_depth (GNUNET_ntohll(dc->uri->data.chk.file_length));
+ dc->treedepth = GNUNET_FS_compute_depth (GNUNET_FS_uri_chk_get_file_size(dc->uri));
if ( (filename == NULL) &&
(is_recursive_download (dc) ) )
{
pi.value.download.specifics.start.meta = meta;
GNUNET_FS_download_make_status_ (&pi, dc);
schedule_block_download (dc,
- &dc->uri->data.chk.chk,
+ (dc->uri->type == chk)
+ ? &dc->uri->data.chk.chk
+ : &dc->uri->data.loc.fi.chk,
0,
1 /* 0 == CHK, 1 == top */);
GNUNET_FS_download_sync_ (dc);
GNUNET_break (0);
return NULL;
}
- GNUNET_assert (GNUNET_FS_uri_test_chk (sr->uri));
+ GNUNET_assert (GNUNET_FS_uri_test_chk (sr->uri) ||
+ GNUNET_FS_uri_test_loc (sr->uri) );
if ( (offset + length < offset) ||
(offset + length > sr->uri->data.chk.file_length) )
{
pi.status = GNUNET_FS_STATUS_DOWNLOAD_STOPPED;
GNUNET_FS_download_make_status_ (&pi, dc);
if (GNUNET_SCHEDULER_NO_TASK != dc->task)
- GNUNET_SCHEDULER_cancel (dc->h->sched,
- dc->task);
+ GNUNET_SCHEDULER_cancel (dc->task);
GNUNET_CONTAINER_multihashmap_iterate (dc->active,
&free_entry,
NULL);