trying to fix #2000
authorChristian Grothoff <christian@grothoff.org>
Tue, 13 Dec 2011 14:36:14 +0000 (14:36 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 13 Dec 2011 14:36:14 +0000 (14:36 +0000)
src/fs/gnunet-service-fs.c
src/fs/gnunet-service-fs_lc.c
src/fs/gnunet-service-fs_pr.h

index 2a90b538c3dc4855cdf7f1a129376fe9a5f85714..cdf8f43255fc3841b00e95c8598e43360992114c 100644 (file)
@@ -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:
index 502cef941d29c17ade95b0ec48cea3de72cc6121..d8f7d5cb3ef51bbe5b5b251d8abcab5db0b88795 100644 (file)
@@ -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;
index 00249afcf6a20983461086c258b3025ca797112c..e15ea0b54cbba8ffab2e8019e700ee1679446c85 100644 (file)
@@ -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;
+
 };