indentation, comment and style fixes, no semantic changes
[oweals/gnunet.git] / src / fs / fs_search.c
index 8a3652e3f492d7920cffaefa47171cde35207db6..e31115f39b5f105f6a425674c83b964ed7c6b938 100644 (file)
@@ -458,8 +458,8 @@ GNUNET_FS_search_start_probe_ (struct GNUNET_FS_SearchResult *sr)
              (unsigned long long) off,
              sr);
   sr->remaining_probe_time =
-      GNUNET_TIME_relative_multiply (sr->h->avg_block_latency,
-                                     2 * (1 + sr->availability_trials));
+      GNUNET_TIME_relative_saturating_multiply (sr->h->avg_block_latency,
+                                                2 * (1 + sr->availability_trials));
   sr->probe_ctx =
       GNUNET_FS_download_start (sr->h, sr->uri, sr->meta, NULL, NULL, off,
                                 len, sr->anonymity,
@@ -1145,7 +1145,7 @@ schedule_transmit_search_request (struct GNUNET_FS_SearchContext *sc)
                                              &build_result_set,
                                              &mbc);
       search_request_map_offset += todo;
-      GNUNET_assert (0 == mbc.put_cnt);
+      GNUNET_assert (0 == mbc.put_cnt); /* #4608 reports this fails? */
       GNUNET_assert (total_seen_results >= search_request_map_offset);
       if (total_seen_results != search_request_map_offset)
       {
@@ -1234,17 +1234,17 @@ search_mq_error_handler (void *cls,
 static void
 do_reconnect (void *cls)
 {
-  GNUNET_MQ_hd_var_size (result,
-                         GNUNET_MESSAGE_TYPE_FS_PUT,
-                         struct ClientPutMessage);
   struct GNUNET_FS_SearchContext *sc = cls;
   struct GNUNET_MQ_MessageHandler handlers[] = {
-    make_result_handler (sc),
+    GNUNET_MQ_hd_var_size (result,
+                           GNUNET_MESSAGE_TYPE_FS_PUT,
+                           struct ClientPutMessage,
+                           sc),
     GNUNET_MQ_handler_end ()
   };
 
   sc->task = NULL;
-  sc->mq = GNUNET_CLIENT_connecT (sc->h->cfg,
+  sc->mq = GNUNET_CLIENT_connect (sc->h->cfg,
                                   "fs",
                                   handlers,
                                   &search_mq_error_handler,
@@ -1383,9 +1383,10 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc)
     GNUNET_assert (0 != sc->uri->data.ksk.keywordCount);
     anon = GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
     GNUNET_CRYPTO_ecdsa_key_get_public (anon, &anon_pub);
-    sc->requests =
-        GNUNET_malloc (sizeof (struct SearchRequestEntry) *
-                       sc->uri->data.ksk.keywordCount);
+    sc->requests
+      = GNUNET_new_array (sc->uri->data.ksk.keywordCount,
+                          struct SearchRequestEntry);
+
     for (i = 0; i < sc->uri->data.ksk.keywordCount; i++)
     {
       keyword = &sc->uri->data.ksk.keywords[i][1];