aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fs/fs_download.c2
-rw-r--r--src/fs/gnunet-service-fs_cp.c13
-rw-r--r--src/fs/gnunet-service-fs_lc.c14
-rw-r--r--src/fs/gnunet-service-fs_pr.c4
-rw-r--r--src/fs/gnunet-service-fs_pr.h2
5 files changed, 33 insertions, 2 deletions
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c
index 8192b8c1f6..785803edfe 100644
--- a/src/fs/fs_download.c
+++ b/src/fs/fs_download.c
@@ -31,7 +31,7 @@
#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
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 92461e4778..5aba832982 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -616,6 +616,7 @@ copy_reply (void *cls,
*
* @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
@@ -624,6 +625,7 @@ copy_reply (void *cls,
*/
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,
@@ -683,6 +685,17 @@ handle_p2p_reply (void *cls,
msize,
&copy_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);
}
diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c
index 3908b8a558..58a1a0933a 100644
--- a/src/fs/gnunet-service-fs_lc.c
+++ b/src/fs/gnunet-service-fs_lc.c
@@ -188,6 +188,7 @@ GSF_local_client_lookup_ (struct GNUNET_SERVER_Client *client)
* 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
@@ -196,6 +197,7 @@ GSF_local_client_lookup_ (struct GNUNET_SERVER_Client *client)
*/
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,
@@ -242,6 +244,18 @@ client_response_handler (void *cls,
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);
+
}
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index f8ca828003..f327d9b4b3 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -338,6 +338,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options,
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,
@@ -705,11 +706,11 @@ process_reply (void *cls,
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,
@@ -764,6 +765,7 @@ process_reply (void *cls,
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,
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h
index b546fc1abb..fa3c51ffdb 100644
--- a/src/fs/gnunet-service-fs_pr.h
+++ b/src/fs/gnunet-service-fs_pr.h
@@ -158,6 +158,7 @@ struct GSF_PendingRequestData
* 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
@@ -165,6 +166,7 @@ struct GSF_PendingRequestData
* @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,