aboutsummaryrefslogtreecommitdiff
path: root/src/ats-tool/gnunet-ats.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-16 08:23:46 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-16 08:23:46 +0000
commit2935aa4661612e6fa616864426e3d185f6497a15 (patch)
tree6ce10947de8c4b5362b87ca8c15eea3fe9807ebe /src/ats-tool/gnunet-ats.c
parentc2d8df6aa4fe7852599b5673f95b3504ba35a40f (diff)
downloadgnunet-2935aa4661612e6fa616864426e3d185f6497a15.tar.gz
gnunet-2935aa4661612e6fa616864426e3d185f6497a15.zip
print active/inactive information
Diffstat (limited to 'src/ats-tool/gnunet-ats.c')
-rw-r--r--src/ats-tool/gnunet-ats.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c
index 6a34f4e15..a1e2df7a6 100644
--- a/src/ats-tool/gnunet-ats.c
+++ b/src/ats-tool/gnunet-ats.c
@@ -209,6 +209,12 @@ struct ATSAddress
209 * Current inbound bandwidth. 209 * Current inbound bandwidth.
210 */ 210 */
211 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in; 211 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
212
213 /**
214 * Is this an active address?
215 */
216 int active;
217
212}; 218};
213 219
214 220
@@ -375,7 +381,7 @@ transport_addr_to_str_cb (void *cls,
375 return; 381 return;
376 } 382 }
377 383
378 ats_str = GNUNET_strdup (""); 384 ats_str = GNUNET_strdup (pr->active ? _("active ") : _("inactive "));
379 network = GNUNET_ATS_NET_UNSPECIFIED; 385 network = GNUNET_ATS_NET_UNSPECIFIED;
380 for (c = 0; c < pr->ats_count; c++) 386 for (c = 0; c < pr->ats_count; c++)
381 { 387 {
@@ -538,7 +544,8 @@ ats_perf_mon_cb (void *cls,
538 if ((NULL != actx.res)) 544 if ((NULL != actx.res))
539 { 545 {
540 if ((bandwidth_in.value__ == actx.res->bandwidth_in.value__) && 546 if ((bandwidth_in.value__ == actx.res->bandwidth_in.value__) &&
541 (bandwidth_out.value__ == actx.res->bandwidth_out.value__)) 547 (bandwidth_out.value__ == actx.res->bandwidth_out.value__) &&
548 (active == actx.res->active))
542 { 549 {
543 return; /* Nothing to do here */ 550 return; /* Nothing to do here */
544 } 551 }
@@ -551,9 +558,11 @@ ats_perf_mon_cb (void *cls,
551 else 558 else
552 { 559 {
553 a = GNUNET_new (struct ATSAddress); 560 a = GNUNET_new (struct ATSAddress);
561
554 a->address = GNUNET_HELLO_address_copy(address); 562 a->address = GNUNET_HELLO_address_copy(address);
555 a->bandwidth_in = bandwidth_in; 563 a->bandwidth_in = bandwidth_in;
556 a->bandwidth_out = bandwidth_out; 564 a->bandwidth_out = bandwidth_out;
565 a->active = active;
557 GNUNET_CONTAINER_multipeermap_put (addresses, 566 GNUNET_CONTAINER_multipeermap_put (addresses,
558 &address->peer, 567 &address->peer,
559 a, 568 a,
@@ -571,6 +580,7 @@ ats_perf_mon_cb (void *cls,
571 pr->address = GNUNET_HELLO_address_copy (address); 580 pr->address = GNUNET_HELLO_address_copy (address);
572 pr->bandwidth_in = bandwidth_in; 581 pr->bandwidth_in = bandwidth_in;
573 pr->bandwidth_out = bandwidth_out; 582 pr->bandwidth_out = bandwidth_out;
583 pr->active = active;
574 pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address, 584 pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address,
575 resolve_addresses_numeric, 585 resolve_addresses_numeric,
576 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), 586 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
@@ -802,7 +812,9 @@ testservice_ats (void *cls,
802 } 812 }
803 813
804 alh = GNUNET_ATS_performance_list_addresses (ph, 814 alh = GNUNET_ATS_performance_list_addresses (ph,
805 (NULL == pid_str) ? NULL : &pid, GNUNET_YES, ats_perf_cb, NULL); 815 (NULL == pid_str) ? NULL : &pid,
816 GNUNET_YES,
817 &ats_perf_cb, NULL);
806 if (NULL == alh) 818 if (NULL == alh)
807 { 819 {
808 FPRINTF (stderr, 820 FPRINTF (stderr,