&basename))
return NULL;
GNUNET_asprintf (&ret,
- "%s%s%s%s%s%s",
+ "%s%s%s%s%s%s%s",
basename,
DIR_SEPARATOR_STR,
h->client_name,
&basename))
return NULL;
GNUNET_asprintf (&ret,
- "%s%s%s%s%s%s%s%s",
+ "%s%s%s%s%s%s%s%s%s",
basename,
DIR_SEPARATOR_STR,
h->client_name,
fn = get_serialization_file_name (h, ext, ent);
if (fn == NULL)
- return NULL;
+ {
+ return NULL;
+ }
ret = GNUNET_BIO_write_open (fn);
+ if (ret == NULL)
+ fprintf (stderr,
+ "Failed to create write handle for `%s' from `%s/%s'\n",
+ fn, ext, ent);
GNUNET_free (fn);
return ret;
}
nxt = fullname;
/* FIXME: we could do this faster since we know
the length of 'end'... */
- while ('\0' != nxt)
+ while ('\0' != *nxt)
{
if (DIR_SEPARATOR == *nxt)
end = nxt + 1;
goto cleanup;
}
if (GNUNET_OK !=
- GNUNET_BIO_write_string (wh, fi->next->serialization))
+ GNUNET_BIO_write_string (wh, (fi->next != NULL) ? fi->next->serialization : NULL))
goto cleanup;
if (GNUNET_OK ==
GNUNET_BIO_write_close (wh))
return;
}
wh = get_write_handle (pc->h, GNUNET_FS_SYNC_PATH_MASTER_PUBLISH, pc->serialization);
+ if (wh == NULL)
+ goto cleanup;
if ( (GNUNET_OK !=
GNUNET_BIO_write_string (wh, pc->nid)) ||
(GNUNET_OK !=
if (NULL == uc->serialization)
return;
wh = get_write_handle (uc->h, GNUNET_FS_SYNC_PATH_MASTER_UNINDEX, uc->serialization);
+ if (wh == NULL)
+ goto cleanup;
if ( (GNUNET_OK !=
GNUNET_BIO_write_string (wh, uc->filename)) ||
(GNUNET_OK !=
: GNUNET_FS_SYNC_PATH_CHILD_SEARCH,
sr->sc->serialization,
sr->serialization);
+ if (wh == NULL)
+ goto cleanup;
uris = GNUNET_FS_uri_to_string (sr->uri);
if ( (GNUNET_OK !=
GNUNET_BIO_write_string (wh, uris)) ||
if (NULL == sc->serialization)
return;
wh = get_write_handle (sc->h, category, sc->serialization);
+ if (wh == NULL)
+ goto cleanup;
GNUNET_assert ( (GNUNET_YES == GNUNET_FS_uri_test_ksk (sc->uri)) ||
(GNUNET_YES == GNUNET_FS_uri_test_sks (sc->uri)) );
uris = GNUNET_FS_uri_to_string (sc->uri);
uint64_t size;
p = sc->fi_pos;
+ GNUNET_assert (p != NULL);
if (NULL == p->te)
{
if (p->is_directory)
if (NULL != nuid)
ret->nuid = GNUNET_strdup (nuid);
}
- GNUNET_FS_publish_sync_ (ret);
/* signal start */
GNUNET_FS_file_information_inspect (ret->fi,
&fip_signal_start,
ret);
ret->fi_pos = ret->fi;
ret->top = GNUNET_FS_make_top (h, &publish_signal_suspend, ret);
+ GNUNET_FS_publish_sync_ (ret);
// FIXME: calculate space needed for "fi"
// and reserve as first task (then trigger
// "publish_main" from that continuation)!
pi.status = GNUNET_FS_STATUS_UNINDEX_START;
pi.value.unindex.eta = GNUNET_TIME_UNIT_FOREVER_REL;
GNUNET_FS_unindex_make_status_ (&pi, ret, 0);
+ /* FIXME: must be able to abort hashing here! */
GNUNET_CRYPTO_hash_file (h->sched,
GNUNET_SCHEDULER_PRIORITY_IDLE,
filename,
GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc)
{
struct GNUNET_FS_ProgressInfo pi;
-
+
+ /* FIXME: stop hashing (if still ongoing) */
+ /* FIXME: disconnect uc->client (if still connected) */
+ /* FIXME: disconnect from datastore (if still connected) */
+ /* FIXME: other termination operations? */
+ /* FIXME: must do same cleanup in 'unindex_signal_suspend'! */
GNUNET_FS_end_top (uc->h, uc->top);
if ( (uc->state != UNINDEX_STATE_COMPLETE) &&
(uc->state != UNINDEX_STATE_ERROR) )