#include "gnunet_fs_service.h"
#include "fs.h"
+#define DEBUG_NAMESPACE GNUNET_NO
+
/**
* Return the name of the directory in which we store
* our local namespaces (or rather, their public keys).
GNUNET_break (0);
GNUNET_free (emsg);
GNUNET_free (n->id);
- GNUNET_free (n->update);
+ GNUNET_free_non_null (n->update);
GNUNET_CONTAINER_meta_data_destroy (n->md);
GNUNET_free (n);
break;
*/
struct GNUNET_DATASTORE_Handle *dsh;
- /**
- * Our scheduler.
- */
- struct GNUNET_SCHEDULER_Handle *sched;
-
/**
* Our KSK URI.
*/
if (GNUNET_OK != success)
{
/* error! */
- GNUNET_SCHEDULER_add_continuation (ac->sched,
- &do_disconnect,
+ GNUNET_SCHEDULER_add_continuation (&do_disconnect,
ac->dsh,
GNUNET_SCHEDULER_REASON_PREREQ_DONE);
- ac->cont (ac->cont_cls, NULL, msg);
+ if (ac->cont != NULL)
+ ac->cont (ac->cont_cls, NULL, msg);
GNUNET_FS_uri_destroy (ac->ksk_uri);
GNUNET_free (ac->pt);
GNUNET_free (ac->nb);
if (ac->pos == ac->ksk_uri->data.ksk.keywordCount)
{
/* done! */
- GNUNET_SCHEDULER_add_continuation (ac->sched,
- &do_disconnect,
+ GNUNET_SCHEDULER_add_continuation (&do_disconnect,
ac->dsh,
GNUNET_SCHEDULER_REASON_PREREQ_DONE);
- ac->cont (ac->cont_cls, ac->ksk_uri, NULL);
+ if (ac->cont != NULL)
+ ac->cont (ac->cont_cls, ac->ksk_uri, NULL);
GNUNET_FS_uri_destroy (ac->ksk_uri);
GNUNET_free (ac->pt);
GNUNET_free (ac->nb);
&query,
ac->pt_size + sizeof (struct NBlock),
ac->nb,
- GNUNET_BLOCK_TYPE_NBLOCK,
+ GNUNET_BLOCK_TYPE_FS_NBLOCK,
ac->priority,
ac->anonymity,
ac->expiration,
nb->ns_purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK);
nb->ksk_purpose.size = htonl (size - sizeof (struct GNUNET_CRYPTO_RsaSignature));
nb->ksk_purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK_KSIG);
- dsh = GNUNET_DATASTORE_connect (h->cfg, h->sched);
+ dsh = GNUNET_DATASTORE_connect (h->cfg);
if (NULL == dsh)
{
GNUNET_free (nb);
ctx->cont = cont;
ctx->cont_cls = cont_cls;
ctx->dsh = dsh;
- ctx->sched = h->sched;
ctx->ksk_uri = GNUNET_FS_uri_dup (ksk_uri);
ctx->nb = nb;
ctx->pt = pt;
}
if (GNUNET_OK != success)
{
- psc->cont (psc->cont_cls,
- NULL,
- msg);
+ if (psc->cont != NULL)
+ psc->cont (psc->cont_cls,
+ NULL,
+ msg);
}
else
{
psc->nsn = NULL;
write_update_information_graph (psc->namespace);
}
- psc->cont (psc->cont_cls,
- psc->uri,
- NULL);
+ if (psc->cont != NULL)
+ psc->cont (psc->cont_cls,
+ psc->uri,
+ NULL);
}
GNUNET_FS_namespace_delete (psc->namespace,
GNUNET_NO);
NULL);
return;
}
- psc->dsh = GNUNET_DATASTORE_connect (h->cfg, h->sched);
+ psc->dsh = GNUNET_DATASTORE_connect (h->cfg);
if (NULL == psc->dsh)
{
GNUNET_free (sb_enc);
&sb_enc->identifier,
size,
sb_enc,
- GNUNET_BLOCK_TYPE_SBLOCK,
+ GNUNET_BLOCK_TYPE_FS_SBLOCK,
priority,
anonymity,
expirationTime,
{
if (fc->scc_array[nsn->scc_id] != nsn)
return GNUNET_YES; /* part of another SCC, end trace */
+ if (nsn->scc_id == fc->id)
+ return GNUNET_YES; /* that's us */
fc->scc_array[nsn->scc_id] = NULL;
if (fc->id == UINT_MAX)
fc->id = nsn->scc_id; /* take over ID */
if (namespace->update_nodes == NULL)
read_update_information_graph (namespace);
if (namespace->update_nodes == NULL)
- return; /* no nodes */
+ {
+#if DEBUG_NAMESPACE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "No updateable nodes found for ID `%s'\n",
+ next_id);
+#endif
+ return; /* no nodes */
+ }
if (namespace->update_map == NULL)
{
/* need to construct */
&pc);
return;
}
+#if DEBUG_NAMESPACE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Calculating SCCs to find roots of update trees\n");
+#endif
/* Find heads of SCCs in update graph */
nug = ++namespace->nug_gen;
fc.scc_array = NULL;
{
nsn = namespace->update_nodes[i];
if (nsn->nug == nug)
- continue; /* already placed in SCC */
+ {
+#if DEBUG_NAMESPACE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "SCC of node `%s' is %u\n",
+ nsn->id,
+ nsn->nug);
+#endif
+ continue; /* already placed in SCC */
+ }
GNUNET_CRYPTO_hash (nsn->update,
strlen (nsn->update),
&hc);
nsn);
nsn->scc_id = fc.id;
}
+#if DEBUG_NAMESPACE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Starting new SCC %u with node `%s'\n",
+ nsn->scc_id,
+ nsn->id);
+#endif
/* put all nodes with same identifier into this SCC */
GNUNET_CRYPTO_hash (nsn->id,
strlen (nsn->id),
fc.scc_array[fc.id] = nsn;
nsn->scc_id = fc.id;
}
+#if DEBUG_NAMESPACE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "SCC of node `%s' is %u\n",
+ nsn->id,
+ fc.id);
+#endif
}
for (i=0;i<fc.scc_array_size;i++)
{
nsn = fc.scc_array[i];
if (NULL != nsn)
- ip (ip_cls,
- nsn->id,
- nsn->uri,
- nsn->md,
- nsn->update);
+ {
+#if DEBUG_NAMESPACE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Root of SCC %u is node `%s'\n",
+ i,
+ nsn->id);
+#endif
+
+ ip (ip_cls,
+ nsn->id,
+ nsn->uri,
+ nsn->md,
+ nsn->update);
+ }
}
GNUNET_array_grow (fc.scc_array,
fc.scc_array_size,
0);
+#if DEBUG_NAMESPACE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Done processing SCCs\n");
+#endif
}