diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-24 14:11:17 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-24 14:11:17 +0000 |
commit | 6e03d509075d2cd38fabab6568b4c2bf2451505e (patch) | |
tree | 245379e96866662db100eb35c75be1206f1f661b /src/ats | |
parent | c77bdc9b0fec7ce8201c5f3f5c915485abaf2dcd (diff) | |
download | gnunet-6e03d509075d2cd38fabab6568b4c2bf2451505e.tar.gz gnunet-6e03d509075d2cd38fabab6568b4c2bf2451505e.zip |
-fixing misc format strings
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 43 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_performance.c | 32 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_scheduling.c | 7 | ||||
-rw-r--r-- | src/ats/perf_ats_solver.c | 21 | ||||
-rw-r--r-- | src/ats/test_ats_mlp_averaging.c | 6 | ||||
-rw-r--r-- | src/ats/test_ats_simplistic_pref_aging.c | 276 | ||||
-rwxr-xr-x | src/ats/test_ats_solver_convergence.c | 30 | ||||
-rw-r--r-- | src/ats/test_ats_solver_request_and_delete_address.c | 8 |
8 files changed, 224 insertions, 199 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index 8e47ae74c..366010afb 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -1323,9 +1323,10 @@ GAS_addresses_handle_backoff_reset (struct GAS_Addresses_Handle *handle, | |||
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | 1325 | ||
1326 | |||
1327 | static int | 1326 | static int |
1328 | eval_count_active_it (void *cls, const struct GNUNET_PeerIdentity *id, void *obj) | 1327 | eval_count_active_it (void *cls, |
1328 | const struct GNUNET_PeerIdentity *id, | ||
1329 | void *obj) | ||
1329 | { | 1330 | { |
1330 | int *request_fulfilled = cls; | 1331 | int *request_fulfilled = cls; |
1331 | struct ATS_Address *addr = obj; | 1332 | struct ATS_Address *addr = obj; |
@@ -1343,7 +1344,8 @@ eval_count_active_it (void *cls, const struct GNUNET_PeerIdentity *id, void *obj | |||
1343 | /** | 1344 | /** |
1344 | * Summary context | 1345 | * Summary context |
1345 | */ | 1346 | */ |
1346 | struct SummaryContext { | 1347 | struct SummaryContext |
1348 | { | ||
1347 | /** | 1349 | /** |
1348 | * Sum of the utilized inbound bandwidth per network | 1350 | * Sum of the utilized inbound bandwidth per network |
1349 | */ | 1351 | */ |
@@ -1364,11 +1366,10 @@ struct SummaryContext { | |||
1364 | static int | 1366 | static int |
1365 | eval_sum_bw_used (void *cls, const struct GNUNET_PeerIdentity *id, void *obj) | 1367 | eval_sum_bw_used (void *cls, const struct GNUNET_PeerIdentity *id, void *obj) |
1366 | { | 1368 | { |
1369 | struct SummaryContext *ctx = cls; | ||
1367 | struct ATS_Address *addr = obj; | 1370 | struct ATS_Address *addr = obj; |
1368 | int networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkType; | 1371 | int networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkType; |
1369 | int net; | 1372 | int net; |
1370 | struct SummaryContext *ctx = cls; | ||
1371 | |||
1372 | int c; | 1373 | int c; |
1373 | 1374 | ||
1374 | if (GNUNET_YES == addr->active) | 1375 | if (GNUNET_YES == addr->active) |
@@ -1384,22 +1385,25 @@ eval_sum_bw_used (void *cls, const struct GNUNET_PeerIdentity *id, void *obj) | |||
1384 | } | 1385 | } |
1385 | } | 1386 | } |
1386 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1387 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1387 | "Active address in %s with (in/out) %lu/%lu Bps\n", | 1388 | "Active address in %s with (in/out) %u/%u Bps\n", |
1388 | GNUNET_ATS_print_network_type (net), | 1389 | GNUNET_ATS_print_network_type (net), |
1389 | ntohl (addr->assigned_bw_in.value__), | 1390 | (unsigned int) ntohl (addr->assigned_bw_in.value__), |
1390 | ntohl (addr->assigned_bw_out.value__)); | 1391 | (unsigned int) ntohl (addr->assigned_bw_out.value__)); |
1391 | } | 1392 | } |
1392 | return GNUNET_OK; | 1393 | return GNUNET_OK; |
1393 | } | 1394 | } |
1394 | 1395 | ||
1396 | |||
1395 | /** | 1397 | /** |
1396 | * Summary context | 1398 | * Summary context |
1397 | */ | 1399 | */ |
1398 | struct RelativityContext { | 1400 | struct RelativityContext |
1401 | { | ||
1399 | 1402 | ||
1400 | struct GAS_Addresses_Handle *ah; | 1403 | struct GAS_Addresses_Handle *ah; |
1401 | }; | 1404 | }; |
1402 | 1405 | ||
1406 | |||
1403 | static int | 1407 | static int |
1404 | find_active_address (void *cls, const struct GNUNET_PeerIdentity *id, void *obj) | 1408 | find_active_address (void *cls, const struct GNUNET_PeerIdentity *id, void *obj) |
1405 | { | 1409 | { |
@@ -2045,24 +2049,26 @@ bandwidth_changed_cb (void *cls, struct ATS_Address *address) | |||
2045 | } | 2049 | } |
2046 | if (NULL == cur) | 2050 | if (NULL == cur) |
2047 | { | 2051 | { |
2048 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Nobody is interested in peer `%s' :(\n", | 2052 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
2049 | GNUNET_i2s (&address->peer)); | 2053 | "Nobody is interested in peer `%s' :(\n", |
2054 | GNUNET_i2s (&address->peer)); | ||
2050 | return; | 2055 | return; |
2051 | } | 2056 | } |
2052 | 2057 | ||
2053 | if ((0 == ntohl (address->assigned_bw_in.value__)) | 2058 | if ((0 == ntohl (address->assigned_bw_in.value__)) |
2054 | && (0 == ntohl (address->assigned_bw_out.value__))) | 2059 | && (0 == ntohl (address->assigned_bw_out.value__))) |
2055 | { | 2060 | { |
2056 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 2061 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2057 | "Telling transport to disconnect peer `%s'\n", | 2062 | "Telling transport to disconnect peer `%s'\n", |
2058 | GNUNET_i2s (&address->peer)); | 2063 | GNUNET_i2s (&address->peer)); |
2059 | } | 2064 | } |
2060 | else | 2065 | else |
2061 | { | 2066 | { |
2062 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 2067 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
2063 | "Sending bandwidth update for peer `%s': %lu %lu\n", | 2068 | "Sending bandwidth update for peer `%s': %u %u\n", |
2064 | GNUNET_i2s (&address->peer), address->assigned_bw_out.value__, | 2069 | GNUNET_i2s (&address->peer), |
2065 | address->assigned_bw_out.value__); | 2070 | (unsigned int) ntohl (address->assigned_bw_out.value__), |
2071 | (unsigned int) ntohl (address->assigned_bw_out.value__)); | ||
2066 | } | 2072 | } |
2067 | 2073 | ||
2068 | /* *Notify scheduling clients about suggestion */ | 2074 | /* *Notify scheduling clients about suggestion */ |
@@ -2071,6 +2077,7 @@ bandwidth_changed_cb (void *cls, struct ATS_Address *address) | |||
2071 | address->atsi_count, address->assigned_bw_out, address->assigned_bw_in); | 2077 | address->atsi_count, address->assigned_bw_out, address->assigned_bw_in); |
2072 | } | 2078 | } |
2073 | 2079 | ||
2080 | |||
2074 | /** | 2081 | /** |
2075 | * Initialize address subsystem. The addresses subsystem manages the addresses | 2082 | * Initialize address subsystem. The addresses subsystem manages the addresses |
2076 | * known and current performance information. It has a solver component | 2083 | * known and current performance information. It has a solver component |
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c index 6509dbe9d..7e9b4802e 100644 --- a/src/ats/gnunet-service-ats_performance.c +++ b/src/ats/gnunet-service-ats_performance.c | |||
@@ -261,11 +261,11 @@ peerinfo_it (void *cls, | |||
261 | return; | 261 | return; |
262 | 262 | ||
263 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 263 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
264 | "Callback for peer `%s' plugin `%s' BW out %lu, BW in %lu \n", | 264 | "Callback for peer `%s' plugin `%s' BW out %u, BW in %u \n", |
265 | GNUNET_i2s (id), | 265 | GNUNET_i2s (id), |
266 | plugin_name, | 266 | plugin_name, |
267 | ntohl (bandwidth_out.value__), | 267 | (unsigned int) ntohl (bandwidth_out.value__), |
268 | ntohl (bandwidth_in.value__)); | 268 | (unsigned int) ntohl (bandwidth_in.value__)); |
269 | GAS_performance_notify_client(pc, | 269 | GAS_performance_notify_client(pc, |
270 | id, | 270 | id, |
271 | plugin_name, | 271 | plugin_name, |
@@ -405,31 +405,31 @@ req_addr_peerinfo_it (void *cls, | |||
405 | return; | 405 | return; |
406 | } | 406 | } |
407 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 407 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
408 | "Callback for %s peer `%s' plugin `%s' BW out %lu, BW in %lu \n", | 408 | "Callback for %s peer `%s' plugin `%s' BW out %u, BW in %u\n", |
409 | (active == GNUNET_YES) ? "ACTIVE" : "INACTIVE", | 409 | (active == GNUNET_YES) ? "ACTIVE" : "INACTIVE", |
410 | GNUNET_i2s (id), | 410 | GNUNET_i2s (id), |
411 | plugin_name, | 411 | plugin_name, |
412 | ntohl (bandwidth_out.value__), | 412 | (unsigned int) ntohl (bandwidth_out.value__), |
413 | ntohl (bandwidth_in.value__)); | 413 | (unsigned int) ntohl (bandwidth_in.value__)); |
414 | 414 | ||
415 | /* Transmit result */ | 415 | /* Transmit result */ |
416 | if ((GNUNET_YES == ai->all) || (GNUNET_YES == active)) | 416 | if ((GNUNET_YES == ai->all) || (GNUNET_YES == active)) |
417 | { | 417 | { |
418 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 418 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
419 | "Sending result for %s peer `%s' plugin `%s' BW out %lu, BW in %lu \n", | 419 | "Sending result for %s peer `%s' plugin `%s' BW out %u, BW in %u\n", |
420 | (active == GNUNET_YES) ? "ACTIVE" : "INACTIVE", | 420 | (active == GNUNET_YES) ? "ACTIVE" : "INACTIVE", |
421 | GNUNET_i2s (id), | 421 | GNUNET_i2s (id), |
422 | plugin_name, | 422 | plugin_name, |
423 | ntohl (bandwidth_out.value__), | 423 | (unsigned int) ntohl (bandwidth_out.value__), |
424 | ntohl (bandwidth_in.value__)); | 424 | (unsigned int) ntohl (bandwidth_in.value__)); |
425 | transmit_req_addr (cls, | 425 | transmit_req_addr (cls, |
426 | id, | 426 | id, |
427 | plugin_name, | 427 | plugin_name, |
428 | plugin_addr, plugin_addr_len, | 428 | plugin_addr, plugin_addr_len, |
429 | active, | 429 | active, |
430 | atsi, | 430 | atsi, |
431 | atsi_count, | 431 | atsi_count, |
432 | bandwidth_out, bandwidth_in); | 432 | bandwidth_out, bandwidth_in); |
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c index 13aeb2f02..48fe536c1 100644 --- a/src/ats/gnunet-service-ats_scheduling.c +++ b/src/ats/gnunet-service-ats_scheduling.c | |||
@@ -146,9 +146,10 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity | |||
146 | strcpy (&addrp[plugin_addr_len], plugin_name); | 146 | strcpy (&addrp[plugin_addr_len], plugin_name); |
147 | 147 | ||
148 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 148 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
149 | "ATS sends quota for peer `%s': (in/out) %lu/%lu\n", | 149 | "ATS sends quota for peer `%s': (in/out) %u/%u\n", |
150 | GNUNET_i2s (peer), ntohl (bandwidth_in.value__), | 150 | GNUNET_i2s (peer), |
151 | ntohl (bandwidth_out.value__)); | 151 | (unsigned int) ntohl (bandwidth_in.value__), |
152 | (unsigned int) ntohl (bandwidth_out.value__)); | ||
152 | 153 | ||
153 | GNUNET_SERVER_notification_context_unicast (nc, my_client, &msg->header, | 154 | GNUNET_SERVER_notification_context_unicast (nc, my_client, &msg->header, |
154 | GNUNET_YES); | 155 | GNUNET_YES); |
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index 92dfcc0c8..2221ea824 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c | |||
@@ -291,25 +291,26 @@ perf_update_address (struct ATS_Address *cur) | |||
291 | } | 291 | } |
292 | 292 | ||
293 | 293 | ||
294 | |||
295 | static void | 294 | static void |
296 | bandwidth_changed_cb (void *cls, struct ATS_Address *address) | 295 | bandwidth_changed_cb (void *cls, |
296 | struct ATS_Address *address) | ||
297 | { | 297 | { |
298 | if (0 == ntohl(address->assigned_bw_out.value__) && | 298 | if ( (0 == ntohl (address->assigned_bw_out.value__)) && |
299 | 0 == ntohl(address->assigned_bw_in.value__)) | 299 | (0 == ntohl (address->assigned_bw_in.value__)) ) |
300 | return; | 300 | return; |
301 | 301 | ||
302 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 302 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
303 | "Bandwidth changed addresses %s %p to %lu Bps out / %lu Bps in\n", | 303 | "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n", |
304 | GNUNET_i2s (&address->peer), | 304 | GNUNET_i2s (&address->peer), |
305 | address, | 305 | address, |
306 | ntohl(address->assigned_bw_out.value__), | 306 | (unsigned int) ntohl (address->assigned_bw_out.value__), |
307 | ntohl(address->assigned_bw_in.value__)); | 307 | (unsigned int) ntohl (address->assigned_bw_in.value__)); |
308 | if (GNUNET_YES == ph.bulk_running) | 308 | if (GNUNET_YES == ph.bulk_running) |
309 | GNUNET_break (0); | 309 | GNUNET_break (0); |
310 | return; | 310 | return; |
311 | } | 311 | } |
312 | 312 | ||
313 | |||
313 | const double * | 314 | const double * |
314 | get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id) | 315 | get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id) |
315 | { | 316 | { |
diff --git a/src/ats/test_ats_mlp_averaging.c b/src/ats/test_ats_mlp_averaging.c index 4843e1114..45e9388dc 100644 --- a/src/ats/test_ats_mlp_averaging.c +++ b/src/ats/test_ats_mlp_averaging.c | |||
@@ -218,7 +218,10 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
218 | GNUNET_assert (GNUNET_OK == ctx.mlp_result); | 218 | GNUNET_assert (GNUNET_OK == ctx.mlp_result); |
219 | 219 | ||
220 | res[0] = GAS_mlp_get_preferred_address(mlp, addresses, &p[0]); | 220 | res[0] = GAS_mlp_get_preferred_address(mlp, addresses, &p[0]); |
221 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Preferred address `%s' outbound bandwidth: %lu Bps\n",res[0]->plugin, ntohl(res[0]->assigned_bw_out.value__)); | 221 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
222 | "Preferred address `%s' outbound bandwidth: %u Bps\n", | ||
223 | res[0]->plugin, | ||
224 | (unsigned int) ntohl (res[0]->assigned_bw_out.value__)); | ||
222 | 225 | ||
223 | /* Delete an address */ | 226 | /* Delete an address */ |
224 | GNUNET_CONTAINER_multihashmap_remove (addresses, &addr[0].peer.hashPubKey, &addr[0]); | 227 | GNUNET_CONTAINER_multihashmap_remove (addresses, &addr[0].peer.hashPubKey, &addr[0]); |
@@ -233,7 +236,6 @@ check (void *cls, char *const *args, const char *cfgfile, | |||
233 | GNUNET_STATISTICS_destroy(stats, GNUNET_NO); | 236 | GNUNET_STATISTICS_destroy(stats, GNUNET_NO); |
234 | 237 | ||
235 | ret = 0; | 238 | ret = 0; |
236 | return; | ||
237 | } | 239 | } |
238 | 240 | ||
239 | 241 | ||
diff --git a/src/ats/test_ats_simplistic_pref_aging.c b/src/ats/test_ats_simplistic_pref_aging.c index a741ad6bb..f354ce1cc 100644 --- a/src/ats/test_ats_simplistic_pref_aging.c +++ b/src/ats/test_ats_simplistic_pref_aging.c | |||
@@ -166,153 +166,159 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
166 | 166 | ||
167 | if (0 == stage) | 167 | if (0 == stage) |
168 | { | 168 | { |
169 | /* Callback for initial suggestion */ | 169 | /* Callback for initial suggestion */ |
170 | if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id))) | 170 | if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id))) |
171 | { | 171 | { |
172 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 0 `%s': (in/out) %lu/%lu\n", | 172 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
173 | stage, | 173 | "Stage %u: Callback for peer 0 `%s': (in/out) %u/%u\n", |
174 | GNUNET_i2s (&address->peer), | 174 | stage, |
175 | ntohl (bandwidth_in.value__), | 175 | GNUNET_i2s (&address->peer), |
176 | ntohl (bandwidth_out.value__)); | 176 | (unsigned int) ntohl (bandwidth_in.value__), |
177 | sug_p0 = GNUNET_YES; | 177 | (unsigned int) ntohl (bandwidth_out.value__)); |
178 | p0_last_bandwidth_out = ntohl(bandwidth_out.value__); | 178 | sug_p0 = GNUNET_YES; |
179 | p0_last_bandwidth_in = ntohl(bandwidth_in.value__); | 179 | p0_last_bandwidth_out = ntohl(bandwidth_out.value__); |
180 | } | 180 | p0_last_bandwidth_in = ntohl(bandwidth_in.value__); |
181 | if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id))) | 181 | } |
182 | { | 182 | if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id))) |
183 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 1 `%s': (in/out) %lu/%lu\n", | 183 | { |
184 | stage, | 184 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
185 | GNUNET_i2s (&address->peer), | 185 | "Stage %u: Callback for peer 1 `%s': (in/out) %u/%u\n", |
186 | ntohl (bandwidth_in.value__), | 186 | stage, |
187 | ntohl (bandwidth_out.value__)); | 187 | GNUNET_i2s (&address->peer), |
188 | sug_p1 = GNUNET_YES; | 188 | (unsigned int) ntohl (bandwidth_in.value__), |
189 | p1_last_bandwidth_out = ntohl(bandwidth_out.value__); | 189 | (unsigned int) ntohl (bandwidth_out.value__)); |
190 | p1_last_bandwidth_in = ntohl(bandwidth_in.value__); | 190 | sug_p1 = GNUNET_YES; |
191 | } | 191 | p1_last_bandwidth_out = ntohl(bandwidth_out.value__); |
192 | if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1)) | 192 | p1_last_bandwidth_in = ntohl(bandwidth_in.value__); |
193 | { | 193 | } |
194 | /* Changing preference for peer 0 */ | 194 | if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1)) |
195 | stage ++; | 195 | { |
196 | GNUNET_ATS_performance_change_preference (perf_ats, &p[0].id, GNUNET_ATS_PREFERENCE_BANDWIDTH,(double) 1000, GNUNET_ATS_PREFERENCE_END); | 196 | /* Changing preference for peer 0 */ |
197 | sug_p0 = GNUNET_NO; | 197 | stage ++; |
198 | sug_p1 = GNUNET_NO; | 198 | GNUNET_ATS_performance_change_preference (perf_ats, &p[0].id, GNUNET_ATS_PREFERENCE_BANDWIDTH,(double) 1000, GNUNET_ATS_PREFERENCE_END); |
199 | return; | 199 | sug_p0 = GNUNET_NO; |
200 | } | 200 | sug_p1 = GNUNET_NO; |
201 | 201 | return; | |
202 | } | ||
202 | } | 203 | } |
203 | if (1 == stage) | 204 | if (1 == stage) |
204 | { | 205 | { |
205 | /* Callback due to preference change */ | 206 | /* Callback due to preference change */ |
206 | if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id))) | 207 | if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id))) |
207 | { | 208 | { |
208 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 0 `%s': (in/out) %lu/%lu\n", | 209 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
209 | stage, | 210 | "Stage %u: Callback for peer 0 `%s': (in/out) %u/%u\n", |
210 | GNUNET_i2s (&address->peer), | 211 | stage, |
211 | ntohl (bandwidth_in.value__), | 212 | GNUNET_i2s (&address->peer), |
212 | ntohl (bandwidth_out.value__)); | 213 | (unsigned int) ntohl (bandwidth_in.value__), |
213 | sug_p0 = GNUNET_YES; | 214 | (unsigned int) ntohl (bandwidth_out.value__)); |
214 | 215 | sug_p0 = GNUNET_YES; | |
215 | /* Peer 0 should get more bandwidth */ | 216 | |
216 | if (cur_bandwidth_out <= p0_last_bandwidth_out) | 217 | /* Peer 0 should get more bandwidth */ |
217 | GNUNET_break (0); | 218 | if (cur_bandwidth_out <= p0_last_bandwidth_out) |
218 | if (cur_bandwidth_in <= p0_last_bandwidth_in) | 219 | GNUNET_break (0); |
219 | GNUNET_break (0); | 220 | if (cur_bandwidth_in <= p0_last_bandwidth_in) |
220 | p0_last_bandwidth_out = ntohl(bandwidth_out.value__); | 221 | GNUNET_break (0); |
221 | p0_last_bandwidth_in = ntohl(bandwidth_in.value__); | 222 | p0_last_bandwidth_out = ntohl(bandwidth_out.value__); |
222 | } | 223 | p0_last_bandwidth_in = ntohl(bandwidth_in.value__); |
223 | if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id))) | 224 | } |
224 | { | 225 | if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id))) |
225 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 1 `%s': (in/out) %lu/%lu\n", | 226 | { |
226 | stage, | 227 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
227 | GNUNET_i2s (&address->peer), | 228 | "Stage %u: Callback for peer 1 `%s': (in/out) %u/%u\n", |
228 | ntohl (bandwidth_in.value__), | 229 | stage, |
229 | ntohl (bandwidth_out.value__)); | 230 | GNUNET_i2s (&address->peer), |
230 | sug_p1 = GNUNET_YES; | 231 | (unsigned int) ntohl (bandwidth_in.value__), |
231 | 232 | (unsigned int) ntohl (bandwidth_out.value__)); | |
232 | /* Peer 1 should get less bandwidth */ | 233 | sug_p1 = GNUNET_YES; |
233 | if (cur_bandwidth_out >= p1_last_bandwidth_out) | 234 | |
234 | { | 235 | /* Peer 1 should get less bandwidth */ |
235 | GNUNET_break (0); | 236 | if (cur_bandwidth_out >= p1_last_bandwidth_out) |
236 | goto error; | 237 | { |
237 | } | 238 | GNUNET_break (0); |
238 | if (cur_bandwidth_in >= p1_last_bandwidth_in) | 239 | goto error; |
239 | { | 240 | } |
240 | GNUNET_break (0); | 241 | if (cur_bandwidth_in >= p1_last_bandwidth_in) |
241 | goto error; | 242 | { |
242 | } | 243 | GNUNET_break (0); |
243 | p1_last_bandwidth_out = ntohl(bandwidth_out.value__); | 244 | goto error; |
244 | p1_last_bandwidth_in = ntohl(bandwidth_in.value__); | 245 | } |
245 | } | 246 | p1_last_bandwidth_out = ntohl(bandwidth_out.value__); |
246 | if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1)) | 247 | p1_last_bandwidth_in = ntohl(bandwidth_in.value__); |
247 | { | 248 | } |
248 | stage ++; | 249 | if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1)) |
249 | sug_p0 = GNUNET_NO; | 250 | { |
250 | sug_p1 = GNUNET_NO; | 251 | stage ++; |
251 | return; | 252 | sug_p0 = GNUNET_NO; |
252 | } | 253 | sug_p1 = GNUNET_NO; |
254 | return; | ||
255 | } | ||
253 | } | 256 | } |
254 | if (2 == stage) | 257 | if (2 == stage) |
255 | { | 258 | { |
256 | /* Callback due to preference aging */ | 259 | /* Callback due to preference aging */ |
257 | if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id))) | 260 | if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id))) |
258 | { | 261 | { |
259 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 0 `%s': (in/out) %lu/%lu\n", | 262 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
260 | stage, | 263 | "Stage %u: Callback for peer 0 `%s': (in/out) %u/%u\n", |
261 | GNUNET_i2s (&address->peer), | 264 | stage, |
262 | ntohl (bandwidth_in.value__), | 265 | GNUNET_i2s (&address->peer), |
263 | ntohl (bandwidth_out.value__)); | 266 | (unsigned int) ntohl (bandwidth_in.value__), |
264 | sug_p0 = GNUNET_YES; | 267 | (unsigned int) ntohl (bandwidth_out.value__)); |
265 | 268 | sug_p0 = GNUNET_YES; | |
266 | /* Peer 0 should get less bandwidth */ | 269 | |
267 | if (cur_bandwidth_out <= p0_last_bandwidth_out) | 270 | /* Peer 0 should get less bandwidth */ |
268 | GNUNET_break (0); | 271 | if (cur_bandwidth_out <= p0_last_bandwidth_out) |
269 | if (cur_bandwidth_in <= p0_last_bandwidth_in) | 272 | GNUNET_break (0); |
270 | GNUNET_break (0); | 273 | if (cur_bandwidth_in <= p0_last_bandwidth_in) |
271 | p0_last_bandwidth_out = ntohl(bandwidth_out.value__); | 274 | GNUNET_break (0); |
272 | p0_last_bandwidth_in = ntohl(bandwidth_in.value__); | 275 | p0_last_bandwidth_out = ntohl(bandwidth_out.value__); |
273 | } | 276 | p0_last_bandwidth_in = ntohl(bandwidth_in.value__); |
274 | if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id))) | 277 | } |
275 | { | 278 | if (0 == memcmp (&address->peer, &p[1].id, sizeof (p[1].id))) |
276 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stage %u: Callback for peer 1 `%s': (in/out) %lu/%lu\n", | 279 | { |
277 | stage, | 280 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
278 | GNUNET_i2s (&address->peer), | 281 | "Stage %u: Callback for peer 1 `%s': (in/out) %u/%u\n", |
279 | ntohl (bandwidth_in.value__), | 282 | stage, |
280 | ntohl (bandwidth_out.value__)); | 283 | GNUNET_i2s (&address->peer), |
281 | sug_p1 = GNUNET_YES; | 284 | (unsigned int) ntohl (bandwidth_in.value__), |
282 | /* Peer 1 should get more bandwidth */ | 285 | (unsigned int) ntohl (bandwidth_out.value__)); |
283 | if (cur_bandwidth_out <= p1_last_bandwidth_out) | 286 | sug_p1 = GNUNET_YES; |
284 | { | 287 | /* Peer 1 should get more bandwidth */ |
285 | GNUNET_break (0); | 288 | if (cur_bandwidth_out <= p1_last_bandwidth_out) |
286 | goto error; | 289 | { |
287 | } | 290 | GNUNET_break (0); |
288 | if (cur_bandwidth_in <= p1_last_bandwidth_in) | 291 | goto error; |
289 | { | 292 | } |
290 | GNUNET_break (0); | 293 | if (cur_bandwidth_in <= p1_last_bandwidth_in) |
291 | goto error; | 294 | { |
292 | } | 295 | GNUNET_break (0); |
293 | p0_last_bandwidth_out = ntohl(bandwidth_out.value__); | 296 | goto error; |
294 | p0_last_bandwidth_in = ntohl(bandwidth_in.value__); | 297 | } |
295 | } | 298 | p0_last_bandwidth_out = ntohl(bandwidth_out.value__); |
296 | 299 | p0_last_bandwidth_in = ntohl(bandwidth_in.value__); | |
297 | if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1)) | 300 | } |
298 | { | 301 | |
299 | /* Done ! */ | 302 | if ((GNUNET_YES == sug_p0) && (GNUNET_YES == sug_p1)) |
300 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n"); | 303 | { |
301 | stage ++; | 304 | /* Done ! */ |
302 | ret = 0; | 305 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done!\n"); |
303 | GNUNET_SCHEDULER_add_now (&end,NULL); | 306 | stage ++; |
304 | return; | 307 | ret = 0; |
305 | } | 308 | GNUNET_SCHEDULER_add_now (&end,NULL); |
309 | return; | ||
310 | } | ||
306 | } | 311 | } |
307 | return; | 312 | return; |
308 | 313 | ||
309 | error: | 314 | error: |
310 | /* Error ! */ | 315 | /* Error ! */ |
311 | ret = 1; | 316 | ret = 1; |
312 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Error!\n"); | 317 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Error!\n"); |
313 | GNUNET_SCHEDULER_add_now (&end,NULL); | 318 | GNUNET_SCHEDULER_add_now (&end,NULL); |
314 | } | 319 | } |
315 | 320 | ||
321 | |||
316 | static void | 322 | static void |
317 | run (void *cls, | 323 | run (void *cls, |
318 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 324 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
diff --git a/src/ats/test_ats_solver_convergence.c b/src/ats/test_ats_solver_convergence.c index c223eda40..ff476a8c8 100755 --- a/src/ats/test_ats_solver_convergence.c +++ b/src/ats/test_ats_solver_convergence.c | |||
@@ -170,8 +170,11 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
170 | 170 | ||
171 | time_delta = GNUNET_TIME_absolute_get_difference(time_start, GNUNET_TIME_absolute_get()); | 171 | time_delta = GNUNET_TIME_absolute_get_difference(time_start, GNUNET_TIME_absolute_get()); |
172 | 172 | ||
173 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received suggestion for peer '%s': IN %lu - OUT %lu\n", | 173 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
174 | GNUNET_i2s (&address->peer), ntohl(bandwidth_in.value__)/1024, ntohl(bandwidth_out.value__)/1024); | 174 | "Received suggestion for peer '%s': IN %u kb/s - OUT %u kb/s\n", |
175 | GNUNET_i2s (&address->peer), | ||
176 | (unsigned int) ntohl (bandwidth_in.value__)/1024, | ||
177 | (unsigned int) ntohl (bandwidth_out.value__)/1024); | ||
175 | 178 | ||
176 | if (write_data_file) | 179 | if (write_data_file) |
177 | { | 180 | { |
@@ -184,21 +187,24 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
184 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | 187 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); |
185 | if (NULL == data_file_handle) | 188 | if (NULL == data_file_handle) |
186 | { | 189 | { |
187 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to file `%s'\n", data_file_name); | 190 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
191 | "Cannot write data to file `%s'\n", | ||
192 | data_file_name); | ||
188 | } | 193 | } |
189 | else | 194 | else |
190 | { | 195 | { |
191 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(data_file_handle, data, strlen(data))) | 196 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(data_file_handle, data, strlen(data))) |
192 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to file `%s'\n", data_file_name); | 197 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
198 | "Cannot write data to file `%s'\n", | ||
199 | data_file_name); | ||
193 | if (GNUNET_SYSERR == GNUNET_DISK_file_close (data_file_handle)) | 200 | if (GNUNET_SYSERR == GNUNET_DISK_file_close (data_file_handle)) |
194 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file '%s'\n", | 201 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
195 | data_file_name); | 202 | "Cannot close log file '%s'\n", |
203 | data_file_name); | ||
196 | } | 204 | } |
197 | 205 | ||
198 | GNUNET_free(data); | 206 | GNUNET_free(data); |
199 | } | 207 | } |
200 | |||
201 | return; | ||
202 | } | 208 | } |
203 | 209 | ||
204 | 210 | ||
@@ -207,13 +213,15 @@ stat_cb(void *cls, const char *subsystem, | |||
207 | const char *name, uint64_t value, | 213 | const char *name, uint64_t value, |
208 | int is_persistent) | 214 | int is_persistent) |
209 | { | 215 | { |
210 | 216 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | |
211 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "ATS statistics: `%s' `%s' %llu\n", | 217 | "ATS statistics: `%s' `%s' %llu\n", |
212 | subsystem,name, value); | 218 | subsystem,name, |
219 | (unsigned long long) value); | ||
213 | GNUNET_ATS_suggest_address (sched_ats, &p.id); | 220 | GNUNET_ATS_suggest_address (sched_ats, &p.id); |
214 | return GNUNET_OK; | 221 | return GNUNET_OK; |
215 | } | 222 | } |
216 | 223 | ||
224 | |||
217 | static void | 225 | static void |
218 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, | 226 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, |
219 | struct GNUNET_TESTING_Peer *peer) | 227 | struct GNUNET_TESTING_Peer *peer) |
diff --git a/src/ats/test_ats_solver_request_and_delete_address.c b/src/ats/test_ats_solver_request_and_delete_address.c index e0b879433..48ee8014c 100644 --- a/src/ats/test_ats_solver_request_and_delete_address.c +++ b/src/ats/test_ats_solver_request_and_delete_address.c | |||
@@ -159,10 +159,10 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
159 | /* Expecting disconnect */ | 159 | /* Expecting disconnect */ |
160 | 160 | ||
161 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 161 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
162 | "Received sugggestion for peer `%s': %lu %lu\n", | 162 | "Received sugggestion for peer `%s': %u %u\n", |
163 | GNUNET_i2s (&address->peer), | 163 | GNUNET_i2s (&address->peer), |
164 | ntohl(bandwidth_in.value__), | 164 | (unsigned int) ntohl (bandwidth_in.value__), |
165 | ntohl(bandwidth_out.value__)); | 165 | (unsigned int) ntohl (bandwidth_out.value__)); |
166 | 166 | ||
167 | if ((ntohl(bandwidth_in.value__) == 0) && | 167 | if ((ntohl(bandwidth_in.value__) == 0) && |
168 | (ntohl(bandwidth_out.value__) == 0)) | 168 | (ntohl(bandwidth_out.value__) == 0)) |