#include "fs.h"
#include "fs_tree.h"
-#define DEBUG_DOWNLOAD GNUNET_NO
+#define DEBUG_DOWNLOAD GNUNET_YES
/**
* Determine if the given download (options and meta data) should cause
*
* @param cls 'struct GSF_ConnectedPeer' of the peer that would
* have liked an answer to the request
+ * @param eval evaluation of the result
* @param pr handle to the original pending request
* @param expiration when does 'data' expire?
* @param type type of the block
*/
static void
handle_p2p_reply (void *cls,
+ enum GNUNET_BLOCK_EvaluationResult eval,
struct GSF_PendingRequest *pr,
struct GNUNET_TIME_Absolute expiration,
enum GNUNET_BLOCK_Type type,
msize,
©_reply,
pm);
+ if (eval != GNUNET_BLOCK_EVALUATION_OK_LAST)
+ return;
+ GNUNET_STATISTICS_update (GSF_stats,
+ gettext_noop ("# P2P searches active"),
+ -1,
+ GNUNET_NO);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_remove (cp->request_map,
+ &prd->query,
+ pr));
+ GSF_pending_request_cancel_ (pr);
}
* expiration.
*
* @param cls user-specified closure
+ * @param eval evaluation of the result
* @param pr handle to the original pending request
* @param expiration when does 'data' expire?
* @param type type of the block
*/
static void
client_response_handler (void *cls,
+ enum GNUNET_BLOCK_EvaluationResult eval,
struct GSF_PendingRequest *pr,
struct GNUNET_TIME_Absolute expiration,
enum GNUNET_BLOCK_Type type,
GNUNET_h2s (&prd->query),
(unsigned int) prd->type);
#endif
+ if (eval != GNUNET_BLOCK_EVALUATION_OK_LAST)
+ return;
+ GNUNET_CONTAINER_DLL_remove (lc->cr_head,
+ lc->cr_tail,
+ cr);
+ GSF_pending_request_cancel_ (cr->pr);
+ GNUNET_STATISTICS_update (GSF_stats,
+ gettext_noop ("# client searches active"),
+ - 1,
+ GNUNET_NO);
+ GNUNET_free (cr);
+
}
if (pr == dpr)
break; /* let the request live briefly... */
dpr->rh (dpr->rh_cls,
+ GNUNET_BLOCK_EVALUATION_REQUEST_VALID,
dpr,
GNUNET_TIME_UNIT_FOREVER_ABS,
GNUNET_BLOCK_TYPE_ANY,
GNUNET_TIME_absolute_get_duration (pr->public_data.start_time).rel_value);
/* pass on to other peers / local clients */
pr->rh (pr->rh_cls,
+ prq->eval,
pr,
prq->expiration,
prq->type,
prq->data, prq->size);
- GSF_pending_request_cancel_ (pr);
return GNUNET_YES;
case GNUNET_BLOCK_EVALUATION_OK_DUPLICATE:
GNUNET_STATISTICS_update (GSF_stats,
prq->request_found = GNUNET_YES;
/* finally, pass on to other peer / local client */
pr->rh (pr->rh_cls,
+ prq->eval,
pr,
prq->expiration,
prq->type,
* expiration.
*
* @param cls user-specified closure
+ * @param eval evaluation of the result
* @param pr handle to the original pending request
* @param expiration when does 'data' expire?
* @param type type of the block
* @param data_len number of bytes in data
*/
typedef void (*GSF_PendingRequestReplyHandler)(void *cls,
+ enum GNUNET_BLOCK_EvaluationResult eval,
struct GSF_PendingRequest *pr,
struct GNUNET_TIME_Absolute expiration,
enum GNUNET_BLOCK_Type type,