GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"GNS_GET_AUTH: dht lookup for query PSEU timed out.\n");
GNUNET_DHT_get_stop (gph->get_handle);
+ gph->get_handle = NULL;
process_pseu_result(gph, NULL);
}
/* stop lookup and timeout task */
GNUNET_DHT_get_stop (gph->get_handle);
+ gph->get_handle = NULL;
GNUNET_SCHEDULER_cancel(gph->timeout);
gph->get_handle = NULL;
&handle_auth_discovery_timeout, gph);
xquery = htonl(GNUNET_GNS_RECORD_PSEU);
-
+
+ GNUNET_assert(gph->get_handle == NULL);
gph->get_handle = GNUNET_DHT_get_start(dht_handle,
GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_BLOCK_TYPE_GNS_NAMERECORD,
/**
* Cleanup background lookups
*
- * @param cks closure to iterator
+ * @param cls closure to iterator
* @param node heap nodes
* @param element the resolver handle
* @param cost heap cost
GNUNET_CONTAINER_HeapCostType cost)
{
struct ResolverHandle *rh = (struct ResolverHandle *)element;
+ ResolverCleanupContinuation cont = cls;
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"GNS_CLEANUP: Terminating background lookup for %s\n",
rh->name);
GNUNET_DHT_get_stop(rh->get_handle);
+ rh->get_handle = NULL;
rh->proc(rh->proc_cls, rh, 0, NULL);
+ GNUNET_CONTAINER_heap_remove_node(node);
+
+ if (GNUNET_CONTAINER_heap_get_size(dht_lookup_heap) == 0)
+ cont();
+
+
return GNUNET_YES;
}
* Shutdown resolver
*/
void
-gns_resolver_cleanup()
+gns_resolver_cleanup(ResolverCleanupContinuation cont)
{
unsigned int s = GNUNET_CONTAINER_heap_get_size(dht_lookup_heap);
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"GNS_CLEANUP: %d pending background queries to terminate\n", s);
if (0 != s)
- {
GNUNET_CONTAINER_heap_iterate (dht_lookup_heap,
&cleanup_pending_background_queries,
- NULL);
- }
+ cont);
+ else
+ cont();
}
{
//We could do sth verbose/more useful here but it doesn't make any difference
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "GNS_BG: background dht lookup finished.\n");
+ "GNS_BG: background dht lookup for finished.\n");
}
/**
rh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_DHT_get_stop (rh->get_handle);
+ rh->get_handle = NULL;
rh->proc(rh->proc_cls, rh, 0, NULL);
}
/* stop lookup and timeout task */
GNUNET_DHT_get_stop (rh->get_handle);
+ rh->get_handle = NULL;
if (rh->dht_heap_node != NULL)
{
{
rh_heap_root = GNUNET_CONTAINER_heap_remove_root (dht_lookup_heap);
GNUNET_DHT_get_stop(rh_heap_root->get_handle);
+ rh_heap_root->get_handle = NULL;
rh_heap_root->dht_heap_node = NULL;
+
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "GNS_PHASE_REC: Replacing oldest background query for %s\n",
+ rh_heap_root->name);
rh_heap_root->proc(rh_heap_root->proc_cls,
rh_heap_root,
0,
}
xquery = htonl(rlh->record_type);
+
+ GNUNET_assert(rh->get_handle == NULL);
rh->get_handle = GNUNET_DHT_get_start(dht_handle,
GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_BLOCK_TYPE_GNS_NAMERECORD,
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
"GNS_PHASE_DELEGATE: dht lookup for query %s timed out.\n",
- rh->name);
+ rh->authority_name);
rh->status |= TIMED_OUT;
rh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+ GNUNET_DHT_get_stop (rh->get_handle);
+ rh->get_handle = NULL;
+
if (strcmp(rh->name, "") == 0)
{
/*
&background_lookup_result_processor,
NULL);
- GNUNET_DHT_get_stop (rh->get_handle);
-
rh->proc(rh->proc_cls, rh, 0, NULL);
}
rh_heap_root = GNUNET_CONTAINER_heap_remove_root (dht_lookup_heap);
GNUNET_DHT_get_stop(rh_heap_root->get_handle);
rh_heap_root->dht_heap_node = NULL;
+
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "GNS_PHASE_DELEGATE: Replacing oldest background query for %s\n",
+ rh_heap_root->authority_name);
+
rh_heap_root->proc(rh_heap_root->proc_cls,
rh_heap_root,
0,
}
xquery = htonl(GNUNET_GNS_RECORD_PKEY);
-
+
+ GNUNET_assert(rh->get_handle == NULL);
rh->get_handle = GNUNET_DHT_get_start(dht_handle,
GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_BLOCK_TYPE_GNS_NAMERECORD,
rh->proc_cls = rlh;
rh->priv_key = key;
rh->timeout = timeout;
+ rh->get_handle = NULL;
if (timeout.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value)
{
/*