-fixing misc format strings
authorChristian Grothoff <christian@grothoff.org>
Tue, 24 Dec 2013 14:11:17 +0000 (14:11 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 24 Dec 2013 14:11:17 +0000 (14:11 +0000)
src/arm/arm_api.c
src/ats/gnunet-service-ats_addresses.c
src/ats/gnunet-service-ats_performance.c
src/ats/gnunet-service-ats_scheduling.c
src/ats/perf_ats_solver.c
src/ats/test_ats_mlp_averaging.c
src/ats/test_ats_simplistic_pref_aging.c
src/ats/test_ats_solver_convergence.c
src/ats/test_ats_solver_request_and_delete_address.c
src/util/scheduler.c

index ee699739a344fd6655e9731be18afbd99581986e..1b83c31063e84d25519ee1ac4994ea21e0916893 100644 (file)
@@ -474,10 +474,10 @@ client_notify_handler (void *cls,
 /**
  * Transmit the next message to the arm service.
  *
- * @param cls closure with the 'struct GNUNET_ARM_Handle'
- * @param size number of bytes available in buf
+ * @param cls closure with the `struct GNUNET_ARM_Handle`
+ * @param size number of bytes available in @a buf
  * @param buf where the callee should write the message
- * @return number of bytes written to buf
+ * @return number of bytes written to @a buf
  */
 static size_t
 transmit_arm_message (void *cls, size_t size, void *buf)
@@ -491,8 +491,8 @@ transmit_arm_message (void *cls, size_t size, void *buf)
 
   notify_connection = GNUNET_NO;
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-      "transmit_arm_message is running with %p buffer of size %lu. ARM is known to be %s\n",
-      buf, size, h->currently_down ? "unconnected" : "connected");
+       "transmit_arm_message is running with %p buffer of size %lu. ARM is known to be %s\n",
+       buf, size, h->currently_down ? "unconnected" : "connected");
   GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task);
   h->cth = NULL;
   if ((GNUNET_YES == h->currently_down) && (NULL != buf))
@@ -512,7 +512,8 @@ transmit_arm_message (void *cls, size_t size, void *buf)
   }
   if (NULL == (cm = h->control_pending_head))
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Queue is empty, not sending anything\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Queue is empty, not sending anything\n");
     msize = 0;
     goto end;
   }
index 8e47ae74c4b85fa66e5fcbe3a90baa746bb13112..366010afb0512c7af972d55ee6d8e0b620d8b61a 100644 (file)
@@ -1323,9 +1323,10 @@ GAS_addresses_handle_backoff_reset (struct GAS_Addresses_Handle *handle,
 }
 
 
-
 static int
-eval_count_active_it (void *cls, const struct GNUNET_PeerIdentity *id, void *obj)
+eval_count_active_it (void *cls,
+                      const struct GNUNET_PeerIdentity *id,
+                      void *obj)
 {
   int *request_fulfilled = cls;
   struct ATS_Address *addr = obj;
@@ -1343,7 +1344,8 @@ eval_count_active_it (void *cls, const struct GNUNET_PeerIdentity *id, void *obj
 /**
  * Summary context
  */
-struct SummaryContext {
+struct SummaryContext
+{
   /**
    * Sum of the utilized inbound bandwidth per network
    */
@@ -1364,11 +1366,10 @@ struct SummaryContext {
 static int
 eval_sum_bw_used (void *cls, const struct GNUNET_PeerIdentity *id, void *obj)
 {
+  struct SummaryContext *ctx = cls;
   struct ATS_Address *addr = obj;
   int networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkType;
   int net;
-  struct SummaryContext  *ctx = cls;
-
   int c;
 
   if (GNUNET_YES == addr->active)
@@ -1384,22 +1385,25 @@ eval_sum_bw_used (void *cls, const struct GNUNET_PeerIdentity *id, void *obj)
       }
     }
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-        "Active address in  %s with (in/out) %lu/%lu Bps\n",
-        GNUNET_ATS_print_network_type (net),
-        ntohl (addr->assigned_bw_in.value__),
-        ntohl (addr->assigned_bw_out.value__));
+                "Active address in  %s with (in/out) %u/%u Bps\n",
+                GNUNET_ATS_print_network_type (net),
+                (unsigned int) ntohl (addr->assigned_bw_in.value__),
+                (unsigned int) ntohl (addr->assigned_bw_out.value__));
   }
   return GNUNET_OK;
 }
 
+
 /**
  * Summary context
  */
-struct RelativityContext {
+struct RelativityContext
+{
 
   struct GAS_Addresses_Handle *ah;
 };
 
+
 static int
 find_active_address (void *cls, const struct GNUNET_PeerIdentity *id, void *obj)
 {
@@ -2045,24 +2049,26 @@ bandwidth_changed_cb (void *cls, struct ATS_Address *address)
   }
   if (NULL == cur)
   {
-    GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Nobody is interested in peer `%s' :(\n",
-        GNUNET_i2s (&address->peer));
+    GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+               "Nobody is interested in peer `%s' :(\n",
+               GNUNET_i2s (&address->peer));
     return;
   }
 
   if ((0 == ntohl (address->assigned_bw_in.value__))
       && (0 == ntohl (address->assigned_bw_out.value__)))
   {
-    GNUNET_log(GNUNET_ERROR_TYPE_INFO,
-        "Telling transport to disconnect peer `%s'\n",
-        GNUNET_i2s (&address->peer));
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+               "Telling transport to disconnect peer `%s'\n",
+                GNUNET_i2s (&address->peer));
   }
   else
   {
     GNUNET_log(GNUNET_ERROR_TYPE_INFO,
-        "Sending bandwidth update for peer `%s': %lu %lu\n",
-        GNUNET_i2s (&address->peer), address->assigned_bw_out.value__,
-        address->assigned_bw_out.value__);
+               "Sending bandwidth update for peer `%s': %u %u\n",
+               GNUNET_i2s (&address->peer),
+               (unsigned int) ntohl (address->assigned_bw_out.value__),
+               (unsigned int) ntohl (address->assigned_bw_out.value__));
   }
 
   /* *Notify scheduling clients about suggestion */
@@ -2071,6 +2077,7 @@ bandwidth_changed_cb (void *cls, struct ATS_Address *address)
       address->atsi_count, address->assigned_bw_out, address->assigned_bw_in);
 }
 
+
 /**
  * Initialize address subsystem. The addresses subsystem manages the addresses
  * known and current performance information. It has a solver component
index 6509dbe9de304ee11e2a2f7f3b04656eda870a0b..7e9b4802e8633d084b78c69e44a10ce27a8cfba8 100644 (file)
@@ -261,11 +261,11 @@ peerinfo_it (void *cls,
     return;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Callback for peer `%s' plugin `%s' BW out %lu, BW in %lu \n",
+              "Callback for peer `%s' plugin `%s' BW out %u, BW in %u \n",
               GNUNET_i2s (id),
               plugin_name,
-              ntohl (bandwidth_out.value__),
-              ntohl (bandwidth_in.value__));
+              (unsigned int) ntohl (bandwidth_out.value__),
+              (unsigned int) ntohl (bandwidth_in.value__));
   GAS_performance_notify_client(pc,
                                 id,
                                 plugin_name,
@@ -405,31 +405,31 @@ req_addr_peerinfo_it (void *cls,
       return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Callback for  %s peer `%s' plugin `%s' BW out %lu, BW in %lu \n",
+              "Callback for  %s peer `%s' plugin `%s' BW out %u, BW in %u\n",
               (active == GNUNET_YES) ? "ACTIVE" : "INACTIVE",
               GNUNET_i2s (id),
               plugin_name,
-              ntohl (bandwidth_out.value__),
-              ntohl (bandwidth_in.value__));
+              (unsigned int) ntohl (bandwidth_out.value__),
+              (unsigned int) ntohl (bandwidth_in.value__));
 
   /* Transmit result */
   if ((GNUNET_YES == ai->all) || (GNUNET_YES == active))
   {
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Sending result for  %s peer `%s' plugin `%s' BW out %lu, BW in %lu \n",
+                  "Sending result for  %s peer `%s' plugin `%s' BW out %u, BW in %u\n",
                   (active == GNUNET_YES) ? "ACTIVE" : "INACTIVE",
                   GNUNET_i2s (id),
                   plugin_name,
-                  ntohl (bandwidth_out.value__),
-                  ntohl (bandwidth_in.value__));
+                  (unsigned int) ntohl (bandwidth_out.value__),
+                  (unsigned int) ntohl (bandwidth_in.value__));
     transmit_req_addr (cls,
-        id,
-        plugin_name,
-        plugin_addr, plugin_addr_len,
-        active,
-        atsi,
-        atsi_count,
-        bandwidth_out, bandwidth_in);
+                       id,
+                       plugin_name,
+                       plugin_addr, plugin_addr_len,
+                       active,
+                       atsi,
+                       atsi_count,
+                       bandwidth_out, bandwidth_in);
   }
 }
 
index 13aeb2f02bf5c25795ba4be9a71d0e5de3a046ee..48fe536c1a873f62b8061eb7c64eb7f531307396 100644 (file)
@@ -146,9 +146,10 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity
   strcpy (&addrp[plugin_addr_len], plugin_name);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "ATS sends quota for peer `%s': (in/out) %lu/%lu\n",
-              GNUNET_i2s (peer), ntohl (bandwidth_in.value__),
-              ntohl (bandwidth_out.value__));
+              "ATS sends quota for peer `%s': (in/out) %u/%u\n",
+              GNUNET_i2s (peer),
+              (unsigned int) ntohl (bandwidth_in.value__),
+              (unsigned int) ntohl (bandwidth_out.value__));
 
   GNUNET_SERVER_notification_context_unicast (nc, my_client, &msg->header,
                                               GNUNET_YES);
index 92dfcc0c8c3a62ca8626dc5562bbe83e975d36bb..2221ea824e020361912ee965b2a9456ae321fec7 100644 (file)
@@ -291,25 +291,26 @@ perf_update_address (struct ATS_Address *cur)
 }
 
 
-
 static void
-bandwidth_changed_cb (void *cls, struct ATS_Address *address)
+bandwidth_changed_cb (void *cls,
+                      struct ATS_Address *address)
 {
-  if (0 == ntohl(address->assigned_bw_out.value__) &&
-      0 == ntohl(address->assigned_bw_in.value__))
+  if ( (0 == ntohl (address->assigned_bw_out.value__)) &&
+       (0 == ntohl (address->assigned_bw_in.value__)) )
     return;
 
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-      "Bandwidth changed addresses %s %p to %lu Bps out / %lu Bps in\n",
-      GNUNET_i2s (&address->peer),
-      address,
-      ntohl(address->assigned_bw_out.value__),
-      ntohl(address->assigned_bw_in.value__));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n",
+              GNUNET_i2s (&address->peer),
+              address,
+              (unsigned int) ntohl (address->assigned_bw_out.value__),
+              (unsigned int) ntohl (address->assigned_bw_in.value__));
   if (GNUNET_YES == ph.bulk_running)
     GNUNET_break (0);
   return;
 }
 
+
 const double *
 get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id)
 {
index 4843e1114efbae4ad5707ea2763f413069068d82..45e9388dcdbbdf0cd00f3ecae07d38ae02cceb25 100644 (file)
@@ -218,7 +218,10 @@ check (void *cls, char *const *args, const char *cfgfile,
   GNUNET_assert (GNUNET_OK == ctx.mlp_result);
 
   res[0] = GAS_mlp_get_preferred_address(mlp, addresses, &p[0]);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Preferred address `%s' outbound bandwidth: %lu Bps\n",res[0]->plugin, ntohl(res[0]->assigned_bw_out.value__));
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Preferred address `%s' outbound bandwidth: %u Bps\n",
+              res[0]->plugin,
+              (unsigned int) ntohl (res[0]->assigned_bw_out.value__));
 
   /* Delete an address */
   GNUNET_CONTAINER_multihashmap_remove (addresses, &addr[0].peer.hashPubKey, &addr[0]);
@@ -233,7 +236,6 @@ check (void *cls, char *const *args, const char *cfgfile,
   GNUNET_STATISTICS_destroy(stats, GNUNET_NO);
 
   ret = 0;
-  return;
 }
 
 
index a741ad6bb070c2286b54ab18f08859323fabf89f..f354ce1cc1092cdd25e77131c83d1ece0bef428b 100644 (file)
@@ -166,153 +166,159 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
 
   if (0 == stage)
   {
-               /* Callback for initial suggestion */
-               if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id)))
-               {
-                               GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 0 `%s': (in/out) %lu/%lu\n",
-                                               stage,
-                                               GNUNET_i2s (&address->peer),
-                                               ntohl (bandwidth_in.value__),
-                                               ntohl (bandwidth_out.value__));
-                               sug_p0 = GNUNET_YES;
-                               p0_last_bandwidth_out = ntohl(bandwidth_out.value__);
-                               p0_last_bandwidth_in = ntohl(bandwidth_in.value__);
-               }
-               if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id)))
-               {
-                               GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 1 `%s': (in/out) %lu/%lu\n",
-                                               stage,
-                                               GNUNET_i2s (&address->peer),
-                                               ntohl (bandwidth_in.value__),
-                                               ntohl (bandwidth_out.value__));
-                               sug_p1 = GNUNET_YES;
-                               p1_last_bandwidth_out = ntohl(bandwidth_out.value__);
-                               p1_last_bandwidth_in = ntohl(bandwidth_in.value__);
-               }
-               if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1))
-               {
-                 /* Changing preference for peer 0 */
-                       stage ++;
-                       GNUNET_ATS_performance_change_preference (perf_ats, &p[0].id, GNUNET_ATS_PREFERENCE_BANDWIDTH,(double) 1000, GNUNET_ATS_PREFERENCE_END);
-                               sug_p0 = GNUNET_NO;
-                               sug_p1 = GNUNET_NO;
-                       return;
-               }
-
+    /* Callback for initial suggestion */
+    if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id)))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Stage %u: Callback for peer 0 `%s': (in/out) %u/%u\n",
+                  stage,
+                  GNUNET_i2s (&address->peer),
+                  (unsigned int) ntohl (bandwidth_in.value__),
+                  (unsigned int) ntohl (bandwidth_out.value__));
+      sug_p0 = GNUNET_YES;
+      p0_last_bandwidth_out = ntohl(bandwidth_out.value__);
+      p0_last_bandwidth_in = ntohl(bandwidth_in.value__);
+    }
+    if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id)))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Stage %u: Callback for peer 1 `%s': (in/out) %u/%u\n",
+                  stage,
+                  GNUNET_i2s (&address->peer),
+                  (unsigned int) ntohl (bandwidth_in.value__),
+                  (unsigned int) ntohl (bandwidth_out.value__));
+      sug_p1 = GNUNET_YES;
+      p1_last_bandwidth_out = ntohl(bandwidth_out.value__);
+      p1_last_bandwidth_in = ntohl(bandwidth_in.value__);
+    }
+    if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1))
+    {
+      /* Changing preference for peer 0 */
+      stage ++;
+      GNUNET_ATS_performance_change_preference (perf_ats, &p[0].id, GNUNET_ATS_PREFERENCE_BANDWIDTH,(double) 1000, GNUNET_ATS_PREFERENCE_END);
+      sug_p0 = GNUNET_NO;
+      sug_p1 = GNUNET_NO;
+      return;
+    }
   }
   if (1 == stage)
   {
-               /* Callback due to preference change */
-               if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id)))
-               {
-                               GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 0 `%s': (in/out) %lu/%lu\n",
-                                               stage,
-                                               GNUNET_i2s (&address->peer),
-                                               ntohl (bandwidth_in.value__),
-                                               ntohl (bandwidth_out.value__));
-                               sug_p0 = GNUNET_YES;
-
-                               /* Peer 0 should get more bandwidth */
-                               if (cur_bandwidth_out <= p0_last_bandwidth_out)
-                                       GNUNET_break (0);
-                               if (cur_bandwidth_in <= p0_last_bandwidth_in)
-                                       GNUNET_break (0);
-                               p0_last_bandwidth_out = ntohl(bandwidth_out.value__);
-                               p0_last_bandwidth_in = ntohl(bandwidth_in.value__);
-               }
-               if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id)))
-               {
-                               GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 1 `%s': (in/out) %lu/%lu\n",
-                                               stage,
-                                               GNUNET_i2s (&address->peer),
-                                               ntohl (bandwidth_in.value__),
-                                               ntohl (bandwidth_out.value__));
-                               sug_p1 = GNUNET_YES;
-
-                               /* Peer 1 should get less bandwidth */
-                               if (cur_bandwidth_out >= p1_last_bandwidth_out)
-                               {
-                                       GNUNET_break (0);
-                                       goto error;
-                               }
-                               if (cur_bandwidth_in >= p1_last_bandwidth_in)
-                               {
-                                       GNUNET_break (0);
-                                       goto error;
-                               }
-                               p1_last_bandwidth_out = ntohl(bandwidth_out.value__);
-                               p1_last_bandwidth_in = ntohl(bandwidth_in.value__);
-               }
-               if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1))
-               {
-                       stage ++;
-                               sug_p0 = GNUNET_NO;
-                               sug_p1 = GNUNET_NO;
-                       return;
-               }
+    /* Callback due to preference change */
+    if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id)))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Stage %u: Callback for peer 0 `%s': (in/out) %u/%u\n",
+                  stage,
+                  GNUNET_i2s (&address->peer),
+                  (unsigned int) ntohl (bandwidth_in.value__),
+                  (unsigned int) ntohl (bandwidth_out.value__));
+      sug_p0 = GNUNET_YES;
+
+      /* Peer 0 should get more bandwidth */
+      if (cur_bandwidth_out <= p0_last_bandwidth_out)
+        GNUNET_break (0);
+      if (cur_bandwidth_in <= p0_last_bandwidth_in)
+        GNUNET_break (0);
+      p0_last_bandwidth_out = ntohl(bandwidth_out.value__);
+      p0_last_bandwidth_in = ntohl(bandwidth_in.value__);
+    }
+    if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id)))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Stage %u: Callback for peer 1 `%s': (in/out) %u/%u\n",
+                  stage,
+                  GNUNET_i2s (&address->peer),
+                  (unsigned int) ntohl (bandwidth_in.value__),
+                  (unsigned int) ntohl (bandwidth_out.value__));
+      sug_p1 = GNUNET_YES;
+
+      /* Peer 1 should get less bandwidth */
+      if (cur_bandwidth_out >= p1_last_bandwidth_out)
+      {
+        GNUNET_break (0);
+        goto error;
+      }
+      if (cur_bandwidth_in >= p1_last_bandwidth_in)
+      {
+        GNUNET_break (0);
+        goto error;
+      }
+      p1_last_bandwidth_out = ntohl(bandwidth_out.value__);
+      p1_last_bandwidth_in = ntohl(bandwidth_in.value__);
+    }
+    if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1))
+    {
+      stage ++;
+      sug_p0 = GNUNET_NO;
+      sug_p1 = GNUNET_NO;
+      return;
+    }
   }
   if (2 == stage)
   {
-               /* Callback due to preference aging */
-               if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id)))
-               {
-                               GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 0 `%s': (in/out) %lu/%lu\n",
-                                               stage,
-                                               GNUNET_i2s (&address->peer),
-                                               ntohl (bandwidth_in.value__),
-                                               ntohl (bandwidth_out.value__));
-                               sug_p0 = GNUNET_YES;
-
-                               /* Peer 0 should get less bandwidth */
-                               if (cur_bandwidth_out <= p0_last_bandwidth_out)
-                                       GNUNET_break (0);
-                               if (cur_bandwidth_in <= p0_last_bandwidth_in)
-                                       GNUNET_break (0);
-                               p0_last_bandwidth_out = ntohl(bandwidth_out.value__);
-                               p0_last_bandwidth_in = ntohl(bandwidth_in.value__);
-               }
-               if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id)))
-               {
-                               GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 1 `%s': (in/out) %lu/%lu\n",
-                                               stage,
-                                               GNUNET_i2s (&address->peer),
-                                               ntohl (bandwidth_in.value__),
-                                               ntohl (bandwidth_out.value__));
-                               sug_p1 = GNUNET_YES;
-                               /* Peer 1 should get more bandwidth */
-                               if (cur_bandwidth_out <= p1_last_bandwidth_out)
-                               {
-                                       GNUNET_break (0);
-                                       goto error;
-                               }
-                               if (cur_bandwidth_in <= p1_last_bandwidth_in)
-                               {
-                                       GNUNET_break (0);
-                                       goto error;
-                               }
-                               p0_last_bandwidth_out = ntohl(bandwidth_out.value__);
-                               p0_last_bandwidth_in = ntohl(bandwidth_in.value__);
-               }
-
-               if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1))
-               {
-                       /* Done ! */
-                       GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n");
-                       stage ++;
-                       ret = 0;
-        GNUNET_SCHEDULER_add_now (&end,NULL);
-                       return;
-               }
+    /* Callback due to preference aging */
+    if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id)))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Stage %u: Callback for peer 0 `%s': (in/out) %u/%u\n",
+                  stage,
+                  GNUNET_i2s (&address->peer),
+                  (unsigned int) ntohl (bandwidth_in.value__),
+                  (unsigned int) ntohl (bandwidth_out.value__));
+      sug_p0 = GNUNET_YES;
+
+      /* Peer 0 should get less bandwidth */
+      if (cur_bandwidth_out <= p0_last_bandwidth_out)
+        GNUNET_break (0);
+      if (cur_bandwidth_in <= p0_last_bandwidth_in)
+        GNUNET_break (0);
+      p0_last_bandwidth_out = ntohl(bandwidth_out.value__);
+      p0_last_bandwidth_in = ntohl(bandwidth_in.value__);
+    }
+    if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id)))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Stage %u: Callback for peer 1 `%s': (in/out) %u/%u\n",
+                  stage,
+                  GNUNET_i2s (&address->peer),
+                  (unsigned int) ntohl (bandwidth_in.value__),
+                  (unsigned int) ntohl (bandwidth_out.value__));
+      sug_p1 = GNUNET_YES;
+      /* Peer 1 should get more bandwidth */
+      if (cur_bandwidth_out <= p1_last_bandwidth_out)
+      {
+        GNUNET_break (0);
+        goto error;
+      }
+      if (cur_bandwidth_in <= p1_last_bandwidth_in)
+      {
+        GNUNET_break (0);
+        goto error;
+      }
+      p0_last_bandwidth_out = ntohl(bandwidth_out.value__);
+      p0_last_bandwidth_in = ntohl(bandwidth_in.value__);
+    }
+
+    if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1))
+    {
+      /* Done ! */
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n");
+      stage ++;
+      ret = 0;
+      GNUNET_SCHEDULER_add_now (&end,NULL);
+      return;
+    }
   }
   return;
 
 error:
-       /* Error ! */
-       ret = 1;
-       GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Error!\n");
-       GNUNET_SCHEDULER_add_now (&end,NULL);
+  /* Error ! */
+  ret = 1;
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Error!\n");
+  GNUNET_SCHEDULER_add_now (&end,NULL);
 }
 
+
 static void
 run (void *cls,
      const struct GNUNET_CONFIGURATION_Handle *cfg,
index c223eda408ca284224b223bd6c18d75ea8033586..ff476a8c870c590c5d442bc8e8c08fcbc9856d9c 100755 (executable)
@@ -170,8 +170,11 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
 
   time_delta = GNUNET_TIME_absolute_get_difference(time_start, GNUNET_TIME_absolute_get());
 
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received suggestion for peer '%s': IN %lu - OUT %lu\n",
-      GNUNET_i2s (&address->peer), ntohl(bandwidth_in.value__)/1024, ntohl(bandwidth_out.value__)/1024);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Received suggestion for peer '%s': IN %u kb/s - OUT %u kb/s\n",
+              GNUNET_i2s (&address->peer),
+              (unsigned int) ntohl (bandwidth_in.value__)/1024,
+              (unsigned int) ntohl (bandwidth_out.value__)/1024);
 
   if (write_data_file)
   {
@@ -184,21 +187,24 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
         GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
     if (NULL == data_file_handle)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to file `%s'\n", data_file_name);
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Cannot write data to file `%s'\n",
+                  data_file_name);
     }
     else
     {
       if (GNUNET_SYSERR == GNUNET_DISK_file_write(data_file_handle, data, strlen(data)))
-        GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to file `%s'\n", data_file_name);
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "Cannot write data to file `%s'\n",
+                    data_file_name);
       if (GNUNET_SYSERR == GNUNET_DISK_file_close (data_file_handle))
-        GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file '%s'\n",
-                data_file_name);
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    "Cannot close log file '%s'\n",
+                    data_file_name);
     }
 
     GNUNET_free(data);
   }
-
-  return;
 }
 
 
@@ -207,13 +213,15 @@ stat_cb(void *cls, const char *subsystem,
         const char *name, uint64_t value,
         int is_persistent)
 {
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "ATS statistics: `%s' `%s' %llu\n",
-      subsystem,name, value);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "ATS statistics: `%s' `%s' %llu\n",
+              subsystem,name,
+              (unsigned long long) value);
   GNUNET_ATS_suggest_address (sched_ats, &p.id);
   return GNUNET_OK;
 }
 
+
 static void
 run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg,
     struct GNUNET_TESTING_Peer *peer)
index e0b8794338a726424b20d6eb0d89868a7fa9340b..48ee8014c3a6d30a397bb82f5a016ac918528ffd 100644 (file)
@@ -159,10 +159,10 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
     /* Expecting disconnect */
 
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-        "Received sugggestion for peer `%s': %lu %lu\n",
-        GNUNET_i2s (&address->peer),
-        ntohl(bandwidth_in.value__),
-        ntohl(bandwidth_out.value__));
+                "Received sugggestion for peer `%s': %u %u\n",
+                GNUNET_i2s (&address->peer),
+                (unsigned int) ntohl (bandwidth_in.value__),
+                (unsigned int) ntohl (bandwidth_out.value__));
 
     if ((ntohl(bandwidth_in.value__) == 0) &&
         (ntohl(bandwidth_out.value__) == 0))
index fb81bafb75128e2172986e9559f6f775c99890db..2a9623428a33a84ef9c5ced0150386c1ec2f0988 100644 (file)
@@ -1555,6 +1555,7 @@ GNUNET_SCHEDULER_add_write_file (struct GNUNET_TIME_Relative delay,
       task, task_cls);
 }
 
+
 /**
  * Schedule a new task to be run with a specified delay or when the
  * specified file descriptor is ready.  The delay can be