run_time = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2);
end_time = GNUNET_TIME_absolute_add (qe->start_time, run_time);
rst = GNUNET_TIME_absolute_get_remaining (end_time);
- if (0 == rst.rel_value)
+ if (0 == rst.rel_value_us)
{
num_probes_expired++;
stop_job (qe);
qe->blocks * qe->start_times);
end_time = GNUNET_TIME_absolute_add (qe->start_time, run_time);
rst = GNUNET_TIME_absolute_get_remaining (end_time);
- if (0 == rst.rel_value)
+ if (0 == rst.rel_value_us)
{
num_downloads_expired++;
stop_job (qe);
struct GNUNET_TIME_Relative dur;
dur = GNUNET_TIME_absolute_get_duration (timestamp);
- return GNUNET_BIO_write_int64 (wh, dur.rel_value);
+ return GNUNET_BIO_write_int64 (wh, dur.rel_value_us);
}
{
struct GNUNET_TIME_Relative dur;
- if (GNUNET_OK != GNUNET_BIO_read_int64 (rh, &dur.rel_value))
+ if (GNUNET_OK != GNUNET_BIO_read_int64 (rh, &dur.rel_value_us))
return GNUNET_SYSERR;
*timestamp = GNUNET_TIME_absolute_subtract (GNUNET_TIME_absolute_get (), dur);
return GNUNET_OK;
|| (GNUNET_OK !=
GNUNET_BIO_read_string (rh, "fn", &ret->filename, 16 * 1024)) ||
(GNUNET_OK !=
- GNUNET_BIO_read_int64 (rh, &ret->bo.expiration_time.abs_value)) ||
+ GNUNET_BIO_read_int64 (rh, &ret->bo.expiration_time.abs_value_us)) ||
(GNUNET_OK != GNUNET_BIO_read_int32 (rh, &ret->bo.anonymity_level)) ||
(GNUNET_OK != GNUNET_BIO_read_int32 (rh, &ret->bo.content_priority)) ||
(GNUNET_OK != GNUNET_BIO_read_int32 (rh, &ret->bo.replication_level)))
(GNUNET_OK != GNUNET_BIO_write_string (wh, fi->emsg)) ||
(GNUNET_OK != GNUNET_BIO_write_string (wh, fi->filename)) ||
(GNUNET_OK !=
- GNUNET_BIO_write_int64 (wh, fi->bo.expiration_time.abs_value)) ||
+ GNUNET_BIO_write_int64 (wh, fi->bo.expiration_time.abs_value_us)) ||
(GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->bo.anonymity_level)) ||
(GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->bo.content_priority)) ||
(GNUNET_OK != GNUNET_BIO_write_int32 (wh, fi->bo.replication_level)))
struct GNUNET_FS_PublishContext *pc;
int32_t options;
int32_t all_done;
+ int32_t have_ns;
char *fi_root;
- char *ns;
+ struct GNUNET_CRYPTO_EccPrivateKey ns;
char *fi_pos;
char *emsg;
- pc = GNUNET_malloc (sizeof (struct GNUNET_FS_PublishContext));
+ pc = GNUNET_new (struct GNUNET_FS_PublishContext);
pc->h = h;
pc->serialization = get_serialization_short_name (filename);
fi_root = NULL;
fi_pos = NULL;
- ns = NULL;
rh = GNUNET_BIO_read_open (filename);
if (NULL == rh)
{
GNUNET_BIO_read_string (rh, "publish-nuid", &pc->nuid, 1024)) ||
(GNUNET_OK != GNUNET_BIO_read_int32 (rh, &options)) ||
(GNUNET_OK != GNUNET_BIO_read_int32 (rh, &all_done)) ||
+ (GNUNET_OK != GNUNET_BIO_read_int32 (rh, &have_ns)) ||
(GNUNET_OK !=
GNUNET_BIO_read_string (rh, "publish-firoot", &fi_root, 128)) ||
(GNUNET_OK != GNUNET_BIO_read_string (rh, "publish-fipos", &fi_pos, 128))
- || (GNUNET_OK != GNUNET_BIO_read_string (rh, "publish-ns", &ns, 1024)))
+ || ( (GNUNET_YES == have_ns) &&
+ (GNUNET_OK != GNUNET_BIO_read (rh, "publish-ns", &ns, sizeof (ns)))) )
{
GNUNET_break (0);
goto cleanup;
GNUNET_break (0);
goto cleanup;
}
- if (NULL != ns)
+ if (GNUNET_YES == have_ns)
{
- pc->ns = GNUNET_FS_namespace_create (h, ns);
- if (NULL == pc->ns)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _
- ("Failed to recover namespace `%s', cannot resume publishing operation.\n"),
- ns);
- goto cleanup;
- }
+ pc->ns = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey);
+ *pc->ns = ns;
}
if ((0 == (pc->options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) &&
(GNUNET_YES != pc->all_done))
filename, emsg);
GNUNET_free (emsg);
}
- GNUNET_free_non_null (ns);
pc->top = GNUNET_FS_make_top (h, &GNUNET_FS_publish_signal_suspend_, pc);
return GNUNET_OK;
cleanup:
GNUNET_free_non_null (pc->nuid);
GNUNET_free_non_null (fi_root);
GNUNET_free_non_null (fi_pos);
- GNUNET_free_non_null (ns);
if ((NULL != rh) && (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc)
{
struct GNUNET_BIO_WriteHandle *wh;
+ int32_t have_ns;
if (NULL == pc->serialization)
pc->serialization =
GNUNET_break (0);
goto cleanup;
}
+ have_ns = (NULL != pc->ns) ? GNUNET_YES : GNUNET_NO;
if ((GNUNET_OK != GNUNET_BIO_write_string (wh, pc->nid)) ||
(GNUNET_OK != GNUNET_BIO_write_string (wh, pc->nuid)) ||
(GNUNET_OK != GNUNET_BIO_write_int32 (wh, pc->options)) ||
(GNUNET_OK != GNUNET_BIO_write_int32 (wh, pc->all_done)) ||
+ (GNUNET_OK != GNUNET_BIO_write_int32 (wh, have_ns)) ||
(GNUNET_OK != GNUNET_BIO_write_string (wh, pc->fi->serialization)) ||
(GNUNET_OK !=
GNUNET_BIO_write_string (wh,
(NULL == pc->fi_pos) ? NULL : pc->fi_pos->serialization)) ||
- (GNUNET_OK !=
- GNUNET_BIO_write_string (wh,
- (NULL == pc->ns) ? NULL : pc->ns->name)))
+ ( (NULL != pc->ns) &&
+ GNUNET_BIO_write (wh,
+ pc->ns,
+ sizeof (struct GNUNET_CRYPTO_EccPrivateKey)) ) )
{
GNUNET_break (0);
goto cleanup;
/**
* Read a download request tree.
*
- * @param rh stream to read from
+ * @param rh mesh to read from
* @return value the 'struct DownloadRequest', NULL on error
*/
static struct DownloadRequest *
struct GNUNET_BIO_WriteHandle *wh;
char *uris;
+ if (NULL == sr->sc)
+ return;
uris = NULL;
if (NULL == sr->serialization)
sr->serialization =
- make_serialization_file_name_in_dir (sr->sc->h,
+ make_serialization_file_name_in_dir (sr->h,
(sr->sc->psearch_result ==
NULL) ?
GNUNET_FS_SYNC_PATH_MASTER_SEARCH :
sr->sc->serialization);
if (NULL == sr->serialization)
return;
- wh = get_write_handle_in_dir (sr->sc->h,
+ wh = get_write_handle_in_dir (sr->h,
(sr->sc->psearch_result ==
NULL) ? GNUNET_FS_SYNC_PATH_MASTER_SEARCH :
GNUNET_FS_SYNC_PATH_CHILD_SEARCH,
goto cleanup;
}
if ( (NULL != sr->uri) &&
- (ksk == sr->sc->uri->type) &&
+ (GNUNET_FS_URI_KSK == sr->sc->uri->type) &&
(GNUNET_OK != GNUNET_BIO_write (wh, sr->keyword_bitmap,
(sr->sc->uri->data.ksk.keywordCount + 7) / 8)) )
{
GNUNET_free_non_null (uris);
if (NULL != wh)
(void) GNUNET_BIO_write_close (wh);
- remove_sync_file_in_dir (sr->sc->h,
+ remove_sync_file_in_dir (sr->h,
(NULL == sr->sc->psearch_result)
? GNUNET_FS_SYNC_PATH_MASTER_SEARCH
: GNUNET_FS_SYNC_PATH_CHILD_SEARCH,
if (NULL == uc->ksk_uri)
{
GNUNET_break (0);
+ GNUNET_free_non_null (emsg);
goto cleanup;
}
}
download = NULL;
update_srch = NULL;
sr = GNUNET_malloc (sizeof (struct GNUNET_FS_SearchResult));
+ sr->h = sc->h;
sr->sc = sc;
sr->serialization = ser;
if ((GNUNET_OK != GNUNET_BIO_read_string (rh, "result-uri", &uris, 10 * 1024))
GNUNET_break (0);
goto cleanup;
}
- if (ksk == sr->sc->uri->type)
+ if (GNUNET_FS_URI_KSK == sr->sc->uri->type)
{
sr->keyword_bitmap = GNUNET_malloc ((sr->sc->uri->data.ksk.keywordCount + 7) / 8); /* round up, count bits */
if (GNUNET_OK != GNUNET_BIO_read (rh, "keyword-bitmap",
sr->availability_trials;
pi.value.search.specifics.resume_result.applicability_rank =
sr->optional_support;
- sr->client_info = GNUNET_FS_search_make_status_ (&pi, sc);
+ sr->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc);
}
if (NULL != sr->download)
{
}
if (NULL != parent)
{
- GNUNET_abort (); // for debugging for now - FIXME
GNUNET_CONTAINER_DLL_insert (parent->child_head, parent->child_tail, dc);
}
if (NULL != search)
pi.value.search.specifics.resume.message = sc->emsg;
pi.value.search.specifics.resume.is_paused =
(NULL == sc->client) ? GNUNET_YES : GNUNET_NO;
- sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc);
+ sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc);
GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map,
&signal_result_resume, sc);