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;
}
if (NULL != parent)
{
- GNUNET_abort (); // for debugging for now - FIXME
GNUNET_CONTAINER_DLL_insert (parent->child_head, parent->child_tail, dc);
}
if (NULL != search)