start fewer FS probes concurrently, run them all in the same task to avoid undue...
[oweals/gnunet.git] / src / fs / gnunet-service-fs_lc.c
index 8066b264a565ca100c67c1cba0bfd1bec0ce75b8..ef30ba32a03e78e5258a9a0a616cb5ba7f48a85d 100644 (file)
@@ -221,7 +221,7 @@ client_request_destroy (void *cls,
  * @param last_transmission when was the last time we've tried to download this block? (FOREVER if unknown)
  * @param type type of the block
  * @param data response data, NULL on request expiration
- * @param data_len number of bytes in data
+ * @param data_len number of bytes in @e data
  */
 static void
 client_response_handler (void *cls, enum GNUNET_BLOCK_EvaluationResult eval,
@@ -240,8 +240,10 @@ client_response_handler (void *cls, enum GNUNET_BLOCK_EvaluationResult eval,
 
   if (NULL == data)
   {
-    /* ugh, request 'timed out' -- how can this be? */
-    GNUNET_break (0);
+    /* local-only request, with no result, clean up. */
+    if (GNUNET_SCHEDULER_NO_TASK == cr->kill_task)
+      cr->kill_task = GNUNET_SCHEDULER_add_now (&client_request_destroy,
+                                                cr);
     return;
   }
   prd = GSF_pending_request_get_data_ (pr);
@@ -296,17 +298,16 @@ client_response_handler (void *cls, enum GNUNET_BLOCK_EvaluationResult eval,
  * @param client identification of the client
  * @param message the actual message
  * @param prptr where to store the pending request handle for the request
- * @return GNUNET_YES to start local processing,
- *         GNUNET_NO to not (yet) start local processing,
- *         GNUNET_SYSERR on error
+ * @return #GNUNET_YES to start local processing,
+ *         #GNUNET_NO to not (yet) start local processing,
+ *         #GNUNET_SYSERR on error
  */
 int
 GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
-                                        const struct GNUNET_MessageHeader
-                                        *message,
+                                        const struct GNUNET_MessageHeader *message,
                                         struct GSF_PendingRequest **prptr)
 {
-  static struct GNUNET_HashCode all_zeros;
+  static struct GNUNET_PeerIdentity all_zeros;
   const struct SearchMessage *sm;
   struct GSF_LocalClient *lc;
   struct ClientRequest *cr;
@@ -375,12 +376,11 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client,
     if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options)))
       options |= GSF_PRO_LOCAL_ONLY;
     cr->pr = GSF_pending_request_create_ (options, type,
-                                         &sm->query, 
+                                         &sm->query,
                                           (0 !=
                                            memcmp (&sm->target, &all_zeros,
-                                                   sizeof (struct GNUNET_HashCode)))
-                                          ? (const struct GNUNET_PeerIdentity *)
-                                          &sm->target : NULL, NULL, 0,
+                                                   sizeof (struct GNUNET_PeerIdentity)))
+                                          ? &sm->target : NULL, NULL, 0,
                                           0 /* bf */ ,
                                           ntohl (sm->anonymity_level),
                                           0 /* priority */ ,