From: Christian Grothoff Date: Tue, 13 Dec 2011 14:36:14 +0000 (+0000) Subject: trying to fix #2000 X-Git-Tag: initial-import-from-subversion-38251~15657 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0359b6a7261026c230056c121d4344f82814cef6;p=oweals%2Fgnunet.git trying to fix #2000 --- diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 2a90b538c..cdf8f4325 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -348,6 +348,7 @@ handle_p2p_get (void *cls, const struct GNUNET_PeerIdentity *other, pr = GSF_handle_p2p_query_ (other, message); if (NULL == pr) return GNUNET_SYSERR; + GSF_pending_request_get_data_ (pr)->has_started = GNUNET_YES; GSF_local_lookup_ (pr, &consider_forwarding, NULL); update_latencies (atsi, atsi_count); return GNUNET_OK; @@ -415,6 +416,7 @@ handle_start_search (void *cls, struct GNUNET_SERVER_Client *client, GNUNET_SERVER_receive_done (client, GNUNET_OK); break; case GNUNET_YES: + GSF_pending_request_get_data_ (pr)->has_started = GNUNET_YES; GSF_local_lookup_ (pr, &start_p2p_processing, client); break; default: diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c index 502cef941..d8f7d5cb3 100644 --- a/src/fs/gnunet-service-fs_lc.c +++ b/src/fs/gnunet-service-fs_lc.c @@ -332,15 +332,15 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, if ((type == GNUNET_BLOCK_TYPE_FS_KBLOCK) || (type == GNUNET_BLOCK_TYPE_FS_NBLOCK) || (type == GNUNET_BLOCK_TYPE_ANY)) { - /* FIXME: this does currently not work to filter duplicate - * results from *local* datastore since the local store is - * queried before we continue to process additional - * messages from the client! -- fix protocol? */ cr = lc->cr_head; while (cr != NULL) { prd = GSF_pending_request_get_data_ (cr->pr); - if ((0 != memcmp (&prd->query, &sm->query, sizeof (GNUNET_HashCode))) && + /* only unify with queries that hae not yet started local processing + (SEARCH_MESSAGE_OPTION_CONTINUED was always set) and that have a + matching query and type */ + if ((GNUNET_YES != prd->has_started) && + (0 != memcmp (&prd->query, &sm->query, sizeof (GNUNET_HashCode))) && (prd->type == type)) break; cr = cr->next; diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h index 00249afcf..e15ea0b54 100644 --- a/src/fs/gnunet-service-fs_pr.h +++ b/src/fs/gnunet-service-fs_pr.h @@ -146,6 +146,12 @@ struct GSF_PendingRequestData */ int has_target; + /** + * Has this request been started yet (local/p2p operations)? Or are + * we still constructing it? + */ + int has_started; + };