enum GNUNET_BLOCK_EvaluationResult eval;
/**
- *
+ * Peeer which has the data for the key.
*/
- unsigned int current_trail_index;
+ struct GNUNET_PeerIdentity source_peer;
/**
- *
+ * Next hop to forward the get result to.
*/
struct GNUNET_PeerIdentity next_hop;
/**
- * Head of trail to reach this finger.
+ * Head of get path.
*/
struct GetPath *head;
/**
- * Tail of trail to reach this finger.
+ * Tail of get path.
*/
struct GetPath *tail;
/* get_path */
datacache_get_iterator (void *cls,
const struct GNUNET_HashCode * key, size_t size,
const char *data, enum GNUNET_BLOCK_Type type,
- struct GNUNET_TIME_Absolute exp,
- unsigned int put_path_length,
- const struct GNUNET_PeerIdentity *put_path)
+ struct GNUNET_TIME_Absolute exp,
+ unsigned int put_path_length,
+ const struct GNUNET_PeerIdentity *put_path)
{
struct GetRequestContext *ctx = cls;
enum GNUNET_BLOCK_EvaluationResult eval;
i++;
iterator = iterator->next;
}
- GDS_NEIGHBOURS_send_get_result (exp, key, put_path_length, put_path,
- type, size, data, get_path, ctx->get_path_length,
- ctx->current_trail_index, &(ctx->next_hop));
+ GDS_NEIGHBOURS_send_get_result (key,type, &(ctx->next_hop),&(ctx->source_peer),
+ put_path_length, put_path, ctx->get_path_length,
+ get_path, exp, data, size );
- /* forward to other peers */
- GDS_ROUTING_process (type, exp, key, put_path_length, put_path, 0, NULL,
- data, size);
break;
case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
GNUNET_STATISTICS_update (GDS_stats,
uint32_t reply_bf_mutator,
uint32_t get_path_length,
struct GNUNET_PeerIdentity *get_path,
- unsigned int current_trail_index,
- struct GNUNET_PeerIdentity *next_hop)
+ struct GNUNET_PeerIdentity *next_hop,
+ struct GNUNET_PeerIdentity *source_peer)
{
struct GetRequestContext ctx;
unsigned int r;
ctx.reply_bf = reply_bf;
ctx.reply_bf_mutator = reply_bf_mutator;
ctx.get_path_length = get_path_length;
- memcpy (&(ctx.next_hop), next_hop, sizeof (struct GNUNET_PeerIdentity));
- ctx.current_trail_index = current_trail_index;
- /* FIXME: add the get path into ctx and then call gds_neighbours_handle_get*/
+ if (next_hop != NULL)
+ memcpy (&(ctx.next_hop), next_hop, sizeof (struct GNUNET_PeerIdentity));
+
int i = 0;
- while (i < get_path_length)
+
+ if(get_path != NULL)
{
- struct GetPath *element;
- element = GNUNET_malloc (sizeof (struct GetPath));
- element->next = NULL;
- element->prev = NULL;
+ while (i < get_path_length)
+ {
+ struct GetPath *element;
+ element = GNUNET_malloc (sizeof (struct GetPath));
+ element->next = NULL;
+ element->prev = NULL;
- memcpy (&(element->peer), &get_path[i], sizeof(struct GNUNET_PeerIdentity));
- GNUNET_CONTAINER_DLL_insert_tail(ctx.head, ctx.tail, element);
- i++;
+ memcpy (&(element->peer), &get_path[i], sizeof(struct GNUNET_PeerIdentity));
+ GNUNET_CONTAINER_DLL_insert (ctx.head, ctx.tail, element);
+ i++;
+ }
}
r = GNUNET_DATACACHE_get (datacache, key, type, &datacache_get_iterator,