aboutsummaryrefslogtreecommitdiff
path: root/src/ats-tests
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-09-20 08:07:35 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-09-20 08:07:35 +0000
commitd6b447eb42ce0a45d210d35007d330d21448586f (patch)
treeb1de0a02330c9aa735f4428d7efe81748c3aaf58 /src/ats-tests
parentc0ed97f579f033d16fcfacf3db63dcd1377c66c3 (diff)
ats parsing
Diffstat (limited to 'src/ats-tests')
-rw-r--r--src/ats-tests/perf_ats.c46
-rw-r--r--src/ats-tests/perf_ats.h6
2 files changed, 36 insertions, 16 deletions
diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c
index a3b4b2652c..d18527d684 100644
--- a/src/ats-tests/perf_ats.c
+++ b/src/ats-tests/perf_ats.c
@@ -905,32 +905,46 @@ ats_performance_info_cb (void *cls, const struct GNUNET_HELLO_Address *address,
const struct GNUNET_ATS_Information *ats, uint32_t ats_count)
{
struct BenchmarkPeer *me = cls;
+ struct BenchmarkPartner *p;
+ int c_s;
int c_a;
char *peer_id;
+ p = NULL;
+ for (c_s = 0; c_s < me->num_partners; c_s++)
+ {
+
+ if (0 == memcmp (&address->peer, &me->partners[c_s].dest->id,
+ sizeof (struct GNUNET_PeerIdentity)))
+ {
+ p = &me->partners[c_s];
+ break;
+ }
+
+ }
+
+ if (NULL == p)
+ {
+ /* This is not one of my partners
+ * Will happen since the peers will connect to each other due to gossiping
+ */
+ return;
+ }
+
peer_id = GNUNET_strdup (GNUNET_i2s (&me->id));
+
for (c_a = 0; c_a < ats_count; c_a++)
{
- /*GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("%c %03u: %s %s %u\n"),
- (GNUNET_YES == p->master) ? 'M' : 'S',
- p->no,
+ /*
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("%c %03u: %s %s %u\n"),
+ (GNUNET_YES == p->me->master) ? 'M' : 'S',
+ p->me->no,
GNUNET_i2s (&address->peer),
GNUNET_ATS_print_property_type(ntohl(ats[c_a].type)),
- ntohl(ats[c_a].value));*/
- }
-#if 0
- if ((GNUNET_YES == me->master)
- && (0 == memcmp (&address->peer, &me->destination->id,
- sizeof(struct GNUNET_PeerIdentity))))
- {
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Bandwidth for master %u: %lu %lu\n",
- me->no, (long unsigned int ) ntohl (bandwidth_in.value__),
- (long unsigned int ) ntohl (bandwidth_in.value__));
+ ntohl(ats[c_a].value));
+ */
}
- store_information (&bp->id, address, address_active, bandwidth_in,
- bandwidth_out, ats, ats_count);
-#endif
GNUNET_free(peer_id);
}
diff --git a/src/ats-tests/perf_ats.h b/src/ats-tests/perf_ats.h
index cc9a99d69e..15ff5d62a0 100644
--- a/src/ats-tests/perf_ats.h
+++ b/src/ats-tests/perf_ats.h
@@ -100,9 +100,15 @@ struct BenchmarkPartner
*/
unsigned int bytes_received;
+ /* Current ATS properties */
+ uint32_t ats_distance;
+ uint32_t ats_delay;
+ uint32_t bandwidth_in;
+
+ uint32_t bandwidth_out;
};