*/
struct GNUNET_CORE_InformationRequestContext *irc;
+ /**
+ * Reference to DHT get operation for this request (or NULL).
+ */
+ struct GNUNET_DHT_GetHandle *dht_get;
+
/**
* Hash code of all replies that we have seen so far (only valid
* if client is not NULL since we only track replies like this for
static void
process_migration_content (void *cls,
const GNUNET_HashCode * key,
- uint32_t size,
+ size_t size,
const void *data,
enum GNUNET_BLOCK_Type type,
uint32_t priority,
GNUNET_DATASTORE_cancel (pr->qe);
pr->qe = NULL;
}
+ if (pr->dht_get != NULL)
+ {
+ GNUNET_DHT_get_stop (pr->dht_get);
+ pr->dht_get = NULL;
+ }
if (pr->client_request_list != NULL)
{
GNUNET_CONTAINER_DLL_remove (pr->client_request_list->client_list->rl_head,
}
+/**
+ * Iterator called on each result obtained for a DHT
+ * operation that expects a reply
+ *
+ * @param cls closure
+ * @param exp when will this value expire
+ * @param key key of the result
+ * @param get_path NULL-terminated array of pointers
+ * to the peers on reverse GET path (or NULL if not recorded)
+ * @param put_path NULL-terminated array of pointers
+ * to the peers on the PUT path (or NULL if not recorded)
+ * @param type type of the result
+ * @param size number of bytes in data
+ * @param data pointer to the result data
+ */
+static void
+process_dht_reply (void *cls,
+ struct GNUNET_TIME_Absolute exp,
+ const GNUNET_HashCode * key,
+ const struct GNUNET_PeerIdentity * const *get_path,
+ const struct GNUNET_PeerIdentity * const *put_path,
+ enum GNUNET_BLOCK_Type type,
+ size_t size,
+ const void *data);
+
+
/**
* We're processing a GET request and have decided
* to forward it to other peers. This function is called periodically
if (GNUNET_YES == pr->local_only)
return; /* configured to not do P2P search */
/* (0) try DHT */
- if (0 == pr->anonymity_level)
+ if ( (0 == pr->anonymity_level) &&
+ (pr->type != GNUNET_BLOCK_TYPE_FS_DBLOCK) &&
+ (pr->type != GNUNET_BLOCK_TYPE_FS_IBLOCK) )
{
-#if 0
- /* DHT API needs fixing... */
pr->dht_get = GNUNET_DHT_get_start (dht_handle,
GNUNET_TIME_UNIT_FOREVER_REL,
pr->type,
&pr->query,
+ GNUNET_DHT_RO_NONE,
+ pr->bf,
+ pr->mingle,
+ pr->namespace,
+ (pr->namespace != NULL) ? sizeof (GNUNET_HashCode) : 0,
&process_dht_reply,
- pr,
- FIXME,
- FIXME);
-#endif
+ pr);
}
/* (1) select target */
psc.pr = pr;
const void *data;
/**
- * Who gave us this reply? NULL for local host.
+ * Who gave us this reply? NULL for local host (or DHT)
*/
struct ConnectedPeer *sender;
}
+/**
+ * Iterator called on each result obtained for a DHT
+ * operation that expects a reply
+ *
+ * @param cls closure
+ * @param exp when will this value expire
+ * @param key key of the result
+ * @param get_path NULL-terminated array of pointers
+ * to the peers on reverse GET path (or NULL if not recorded)
+ * @param put_path NULL-terminated array of pointers
+ * to the peers on the PUT path (or NULL if not recorded)
+ * @param type type of the result
+ * @param size number of bytes in data
+ * @param data pointer to the result data
+ */
+static void
+process_dht_reply (void *cls,
+ struct GNUNET_TIME_Absolute exp,
+ const GNUNET_HashCode * key,
+ const struct GNUNET_PeerIdentity * const *get_path,
+ const struct GNUNET_PeerIdentity * const *put_path,
+ enum GNUNET_BLOCK_Type type,
+ size_t size,
+ const void *data)
+{
+ struct PendingRequest *pr = cls;
+ struct ProcessReplyClosure prq;
+
+ memset (&prq, 0, sizeof (prq));
+ prq.data = data;
+ prq.expiration = exp;
+ prq.size = size;
+ prq.type = type;
+ process_reply (&prq, key, pr);
+}
+
+
+
/**
* Continuation called to notify client about result of the
* operation.
static void
process_local_reply (void *cls,
const GNUNET_HashCode * key,
- uint32_t size,
+ size_t size,
const void *data,
enum GNUNET_BLOCK_Type type,
uint32_t priority,