-fix indentation, fix bug that caused us to try to merge requests twice
authorChristian Grothoff <christian@grothoff.org>
Sun, 25 Oct 2015 22:39:09 +0000 (22:39 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 25 Oct 2015 22:39:09 +0000 (22:39 +0000)
src/fs/gnunet-service-fs.c
src/fs/gnunet-service-fs_cp.c
src/fs/gnunet-service-fs_pe.c
src/fs/gnunet-service-fs_pe.h

index 11cbe5a7064494c4bb976dd9c1caf966a92bde3a..a4300a4ce853763b122c7c3c37711bd53069cdba 100644 (file)
@@ -575,7 +575,7 @@ shutdown_task (void *cls,
  * peer connects, giving us a chance to decide about submitting
  * the existing request to the new peer.
  *
- * @param cls the 'struct GSF_ConnectedPeer' of the new peer
+ * @param cls the `struct GSF_ConnectedPeer` of the new peer
  * @param key query for the request
  * @param pr handle to the pending request
  * @return #GNUNET_YES to continue to iterate
@@ -589,10 +589,12 @@ consider_peer_for_forwarding (void *cls,
   struct GNUNET_PeerIdentity pid;
 
   GSF_connected_peer_get_identity_ (cp, &pid);
-  if (GNUNET_YES != GSF_pending_request_test_target_ (pr, &pid))
+  if (GNUNET_YES !=
+      GSF_pending_request_test_target_ (pr, &pid))
   {
     GNUNET_STATISTICS_update (GSF_stats,
-                              gettext_noop ("# Loopback routes suppressed"), 1,
+                              gettext_noop ("# Loopback routes suppressed"),
+                              1,
                               GNUNET_NO);
     return GNUNET_YES;
   }
@@ -608,11 +610,13 @@ consider_peer_for_forwarding (void *cls,
  * @param cp handle to the newly created connected peer record
  */
 static void
-connected_peer_cb (void *cls, struct GSF_ConnectedPeer *cp)
+connected_peer_cb (void *cls,
+                   struct GSF_ConnectedPeer *cp)
 {
   if (NULL == cp)
     return;
-  GSF_iterate_pending_requests_ (&consider_peer_for_forwarding, cp);
+  GSF_iterate_pending_requests_ (&consider_peer_for_forwarding,
+                                 cp);
 }
 
 
index 7e5ffb45e02e495d74b83699bc63aa666e2202fa..67338b6ec1c6997a9a1e50e7c48c025a65c64eac 100644 (file)
@@ -658,8 +658,10 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer,
   cp->creation_cb = creation_cb;
   cp->creation_cb_cls = creation_cb_cls;
   cp->respect_iterate_req =
-      GNUNET_PEERSTORE_iterate (peerstore, "fs", peer, "respect",
-                                GNUNET_TIME_UNIT_FOREVER_REL, &peer_respect_cb,
+      GNUNET_PEERSTORE_iterate (peerstore, "fs",
+                                peer, "respect",
+                                GNUNET_TIME_UNIT_FOREVER_REL,
+                                &peer_respect_cb,
                                 cp);
 }
 
index 68c98ae8bd25bb4b2065b470ca71d1020cdcfcb2..a9cfefcaabe197fdeae41145f326f8b8ca966b8c 100644 (file)
@@ -529,7 +529,9 @@ struct MergeContext
  *         #GNUNET_NO if not (merge success)
  */
 static int
-merge_pr (void *cls, const struct GNUNET_HashCode * query, void *element)
+merge_pr (void *cls,
+          const struct GNUNET_HashCode *query,
+          void *element)
 {
   struct MergeContext *mpr = cls;
   struct GSF_RequestPlan *rp = element;
@@ -538,18 +540,26 @@ merge_pr (void *cls, const struct GNUNET_HashCode * query, void *element)
   struct GSF_PendingRequest *latest;
 
   if (GNUNET_OK !=
-      GSF_pending_request_is_compatible_ (mpr->pr, rp->pe_head->pr))
+      GSF_pending_request_is_compatible_ (mpr->pr,
+                                          rp->pe_head->pr))
     return GNUNET_YES;
   /* merge new request with existing request plan */
   bi = GNUNET_new (struct GSF_PendingRequestPlanBijection);
   bi->rp = rp;
   bi->pr = mpr->pr;
   prd = GSF_pending_request_get_data_ (mpr->pr);
-  GNUNET_CONTAINER_MDLL_insert (PR, prd->pr_head, prd->pr_tail, bi);
-  GNUNET_CONTAINER_MDLL_insert (PE, rp->pe_head, rp->pe_tail, bi);
+  GNUNET_CONTAINER_MDLL_insert (PR,
+                                prd->pr_head,
+                                prd->pr_tail,
+                                bi);
+  GNUNET_CONTAINER_MDLL_insert (PE,
+                                rp->pe_head,
+                                rp->pe_tail,
+                                bi);
   mpr->merged = GNUNET_YES;
 #if INSANE_STATISTICS
-  GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# requests merged"), 1,
+  GNUNET_STATISTICS_update (GSF_stats,
+                            gettext_noop ("# requests merged"), 1,
                             GNUNET_NO);
 #endif
   latest = get_latest (rp);
@@ -557,7 +567,8 @@ merge_pr (void *cls, const struct GNUNET_HashCode * query, void *element)
       prd->ttl.abs_value_us)
   {
 #if INSANE_STATISTICS
-    GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# requests refreshed"),
+    GNUNET_STATISTICS_update (GSF_stats,
+                              gettext_noop ("# requests refreshed"),
                               1, GNUNET_NO);
 #endif
     rp->transmission_counter = 0;       /* reset */
@@ -597,38 +608,45 @@ GSF_plan_add_ (struct GSF_ConnectedPeer *cp,
     pp->cp = cp;
     GNUNET_assert (GNUNET_OK ==
                    GNUNET_CONTAINER_multipeermap_put (plans,
-                                                      id, pp,
+                                                      id,
+                                                      pp,
                                                       GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   }
   mpc.merged = GNUNET_NO;
   mpc.pr = pr;
   GNUNET_CONTAINER_multihashmap_get_multiple (pp->plan_map,
                                               &GSF_pending_request_get_data_
-                                              (pr)->query, &merge_pr, &mpc);
-  if (GNUNET_NO != mpc.merged)
-    return;
-  GNUNET_CONTAINER_multihashmap_get_multiple (pp->plan_map,
-                                              &GSF_pending_request_get_data_
-                                              (pr)->query, &merge_pr, &mpc);
+                                              (pr)->query,
+                                              &merge_pr, &mpc);
   if (GNUNET_NO != mpc.merged)
     return;
   plan_count++;
-  GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# query plan entries"), 1,
+  GNUNET_STATISTICS_update (GSF_stats,
+                            gettext_noop ("# query plan entries"),
+                            1,
                             GNUNET_NO);
   prd = GSF_pending_request_get_data_ (pr);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Planning transmission of query `%s' to peer `%s'\n",
-              GNUNET_h2s (&prd->query), GNUNET_i2s (id));
+              GNUNET_h2s (&prd->query),
+              GNUNET_i2s (id));
   rp = GNUNET_new (struct GSF_RequestPlan);
   bi = GNUNET_new (struct GSF_PendingRequestPlanBijection);
   bi->rp = rp;
   bi->pr = pr;
-  GNUNET_CONTAINER_MDLL_insert (PR, prd->pr_head, prd->pr_tail, bi);
-  GNUNET_CONTAINER_MDLL_insert (PE, rp->pe_head, rp->pe_tail, bi);
+  GNUNET_CONTAINER_MDLL_insert (PR,
+                                prd->pr_head,
+                                prd->pr_tail,
+                                bi);
+  GNUNET_CONTAINER_MDLL_insert (PE,
+                                rp->pe_head,
+                                rp->pe_tail,
+                                bi);
   rp->pp = pp;
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_CONTAINER_multihashmap_put (pp->plan_map,
-                                                    get_rp_key (rp), rp,
+                                                    get_rp_key (rp),
+                                                    rp,
                                                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
   plan (pp, rp);
 }
index a6c0114155a2fdd62d2caaad9b39e6c3c1e167fd..a9c3c5c4e43ec1578c4a3f24e8f4d5a0fdac9003 100644 (file)
@@ -36,7 +36,8 @@
  * @param pr request with the entry
  */
 void
-GSF_plan_add_ (struct GSF_ConnectedPeer *cp, struct GSF_PendingRequest *pr);
+GSF_plan_add_ (struct GSF_ConnectedPeer *cp,
+               struct GSF_PendingRequest *pr);
 
 
 /**