diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-10 23:24:01 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-10 23:24:01 +0000 |
commit | 1c323bd4cbb388a9e7515a1f733a3062bf093aee (patch) | |
tree | 7cc525d79149d44840b9f7a0040aaf3e69ecd665 /src/testbed | |
parent | aedaaed687db1ff20b447378f01ad7306921450c (diff) | |
download | gnunet-1c323bd4cbb388a9e7515a1f733a3062bf093aee.tar.gz gnunet-1c323bd4cbb388a9e7515a1f733a3062bf093aee.zip |
fixing #3657 (replace ATS_Information with struct), but WIHTOUT fixing ATS testcases yet
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/gnunet-daemon-latency-logger.c | 22 | ||||
-rw-r--r-- | src/testbed/gnunet-daemon-testbed-underlay.c | 18 |
2 files changed, 16 insertions, 24 deletions
diff --git a/src/testbed/gnunet-daemon-latency-logger.c b/src/testbed/gnunet-daemon-latency-logger.c index a8951c3dd..2dca73768 100644 --- a/src/testbed/gnunet-daemon-latency-logger.c +++ b/src/testbed/gnunet-daemon-latency-logger.c | |||
@@ -68,7 +68,8 @@ struct Entry | |||
68 | struct GNUNET_PeerIdentity id; | 68 | struct GNUNET_PeerIdentity id; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * The last known value for latency | 71 | * The last known value for latency. |
72 | * FIXME: type! | ||
72 | */ | 73 | */ |
73 | unsigned int latency; | 74 | unsigned int latency; |
74 | 75 | ||
@@ -166,8 +167,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
166 | * #GNUNET_SYSERR if this address is no longer available for ATS | 167 | * #GNUNET_SYSERR if this address is no longer available for ATS |
167 | * @param bandwidth_out assigned outbound bandwidth for the connection | 168 | * @param bandwidth_out assigned outbound bandwidth for the connection |
168 | * @param bandwidth_in assigned inbound bandwidth for the connection | 169 | * @param bandwidth_in assigned inbound bandwidth for the connection |
169 | * @param ats performance data for the address (as far as known) | 170 | * @param prop performance data for the address (as far as known) |
170 | * @param ats_count number of performance records in 'ats' | ||
171 | */ | 171 | */ |
172 | static void | 172 | static void |
173 | addr_info_cb (void *cls, | 173 | addr_info_cb (void *cls, |
@@ -175,8 +175,7 @@ addr_info_cb (void *cls, | |||
175 | int address_active, | 175 | int address_active, |
176 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 176 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
177 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 177 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
178 | const struct GNUNET_ATS_Information *ats, | 178 | const struct GNUNET_ATS_Properties *prop) |
179 | uint32_t ats_count) | ||
180 | { | 179 | { |
181 | static const char *query_insert = | 180 | static const char *query_insert = |
182 | "INSERT INTO ats_info(" | 181 | "INSERT INTO ats_info(" |
@@ -189,8 +188,7 @@ addr_info_cb (void *cls, | |||
189 | " datetime('now')" | 188 | " datetime('now')" |
190 | ");"; | 189 | ");"; |
191 | struct Entry *entry; | 190 | struct Entry *entry; |
192 | int latency; | 191 | int latency; /* FIXME: type!? */ |
193 | unsigned int cnt; | ||
194 | 192 | ||
195 | if (NULL == address) | 193 | if (NULL == address) |
196 | { | 194 | { |
@@ -201,15 +199,7 @@ addr_info_cb (void *cls, | |||
201 | GNUNET_assert (NULL != db); | 199 | GNUNET_assert (NULL != db); |
202 | if (GNUNET_YES != address_active) | 200 | if (GNUNET_YES != address_active) |
203 | return; | 201 | return; |
204 | for (cnt = 0; cnt < ats_count; cnt++) | 202 | latency = (int) prop->delay.rel_value_us; |
205 | { | ||
206 | if (GNUNET_ATS_QUALITY_NET_DELAY == ntohl (ats[cnt].type)) | ||
207 | goto insert; | ||
208 | } | ||
209 | return; | ||
210 | |||
211 | insert: | ||
212 | latency = (int) ntohl (ats[cnt].value); | ||
213 | entry = NULL; | 203 | entry = NULL; |
214 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (map, | 204 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (map, |
215 | &address->peer)) | 205 | &address->peer)) |
diff --git a/src/testbed/gnunet-daemon-testbed-underlay.c b/src/testbed/gnunet-daemon-testbed-underlay.c index 49bfc64bf..e41cf4a4d 100644 --- a/src/testbed/gnunet-daemon-testbed-underlay.c +++ b/src/testbed/gnunet-daemon-testbed-underlay.c | |||
@@ -365,13 +365,15 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
365 | struct WhiteListRow *wl_head; | 365 | struct WhiteListRow *wl_head; |
366 | struct WhiteListRow *wl_entry; | 366 | struct WhiteListRow *wl_entry; |
367 | struct GNUNET_PeerIdentity identity; | 367 | struct GNUNET_PeerIdentity identity; |
368 | struct GNUNET_ATS_Information params[1]; | 368 | struct GNUNET_ATS_Properties prop; |
369 | struct GNUNET_TIME_Relative delay; | ||
369 | unsigned long long pid; | 370 | unsigned long long pid; |
370 | unsigned int nrows; | 371 | unsigned int nrows; |
371 | int ret; | 372 | int ret; |
372 | 373 | ||
373 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (c, "TESTBED", | 374 | if (GNUNET_OK != |
374 | "PEERID", &pid)) | 375 | GNUNET_CONFIGURATION_get_value_number (c, "TESTBED", |
376 | "PEERID", &pid)) | ||
375 | { | 377 | { |
376 | GNUNET_break (0); | 378 | GNUNET_break (0); |
377 | return; | 379 | return; |
@@ -418,11 +420,11 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
418 | goto close_db; | 420 | goto close_db; |
419 | } | 421 | } |
420 | map = GNUNET_CONTAINER_multipeermap_create (nrows, GNUNET_NO); | 422 | map = GNUNET_CONTAINER_multipeermap_create (nrows, GNUNET_NO); |
421 | params[0].type = GNUNET_ATS_QUALITY_NET_DELAY; | ||
422 | while (NULL != (wl_entry = wl_head)) | 423 | while (NULL != (wl_entry = wl_head)) |
423 | { | 424 | { |
424 | wl_head = wl_entry->next; | 425 | wl_head = wl_entry->next; |
425 | params[0].value = wl_entry->latency; | 426 | delay.rel_value_us = wl_entry->latency; |
427 | memset (&prop, 0, sizeof (prop)); | ||
426 | GNUNET_assert (GNUNET_OK == get_identity (wl_entry->id, &identity)); | 428 | GNUNET_assert (GNUNET_OK == get_identity (wl_entry->id, &identity)); |
427 | GNUNET_break (GNUNET_OK == | 429 | GNUNET_break (GNUNET_OK == |
428 | GNUNET_CONTAINER_multipeermap_put (map, &identity, &identity, | 430 | GNUNET_CONTAINER_multipeermap_put (map, &identity, &identity, |
@@ -432,9 +434,9 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
432 | GNUNET_i2s (&identity)); | 434 | GNUNET_i2s (&identity)); |
433 | GNUNET_TRANSPORT_set_traffic_metric (transport, | 435 | GNUNET_TRANSPORT_set_traffic_metric (transport, |
434 | &identity, | 436 | &identity, |
435 | GNUNET_YES, | 437 | &prop, |
436 | GNUNET_YES, /* FIXME: Separate inbound, outboud metrics */ | 438 | delay, |
437 | params, 1); | 439 | delay); |
438 | GNUNET_free (wl_entry); | 440 | GNUNET_free (wl_entry); |
439 | } | 441 | } |
440 | bh = GNUNET_TRANSPORT_blacklist (c, &check_access, NULL); | 442 | bh = GNUNET_TRANSPORT_blacklist (c, &check_access, NULL); |