return GNUNET_NO;
}
+
+/**
+ * Task used to remove forwarding entries, either
+ * after timeout, when full, or on shutdown.
+ *
+ * @param cls the entry to remove
+ * @param tc context, reason, etc.
+ */
+static void
+remove_forward_entry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct DHTRouteSource *source_info = cls;
+ struct DHTQueryRecord *record;
+ source_info = GNUNET_CONTAINER_heap_remove_node(forward_list.minHeap, source_info->hnode);
+ record = source_info->record;
+ GNUNET_CONTAINER_DLL_remove(record->head, record->tail, source_info);
+
+ if (record->head == NULL) /* No more entries in DLL */
+ {
+ GNUNET_assert(GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (forward_list.hashmap, &record->key, record));
+ GNUNET_free(record);
+ }
+ if (source_info->find_peers_responded != NULL)
+ GNUNET_CONTAINER_bloomfilter_free(source_info->find_peers_responded);
+ GNUNET_free(source_info);
+}
+
/**
* Main function that handles whether or not to route a result
* message to other peers, or to send to our local client.
msg_ctx->peer, &pos->source);
}
#endif
- forward_result_message(msg, peer_info, msg_ctx);
+ forward_result_message (msg, peer_info, msg_ctx);
+ /* Try removing forward entries after sending once, only allows ONE response per request */
+ if (pos->delete_task != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel(pos->delete_task);
+ pos->delete_task = GNUNET_SCHEDULER_add_now (&remove_forward_entry, pos);
+ }
}
else
{
*/
}
-
-/**
- * Task used to remove forwarding entries, either
- * after timeout, when full, or on shutdown.
- *
- * @param cls the entry to remove
- * @param tc context, reason, etc.
- */
-static void
-remove_forward_entry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct DHTRouteSource *source_info = cls;
- struct DHTQueryRecord *record;
- source_info = GNUNET_CONTAINER_heap_remove_node(forward_list.minHeap, source_info->hnode);
- record = source_info->record;
- GNUNET_CONTAINER_DLL_remove(record->head, record->tail, source_info);
-
- if (record->head == NULL) /* No more entries in DLL */
- {
- GNUNET_assert(GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (forward_list.hashmap, &record->key, record));
- GNUNET_free(record);
- }
- if (source_info->find_peers_responded != NULL)
- GNUNET_CONTAINER_bloomfilter_free(source_info->find_peers_responded);
- GNUNET_free(source_info);
-}
-
/**
* Remember this routing request so that if a reply is
* received we can either forward it to the correct peer