diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-11-19 16:30:11 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-11-19 16:30:11 +0000 |
commit | f64e7ab9c26ccc0d0d32e7458745f2c70bffd352 (patch) | |
tree | 70aaaed20b22fc05e242f7088b73b30cea578612 /src/ats-tool | |
parent | 6c937680c28892c73b6fd380d4ee75e5251274fb (diff) | |
download | gnunet-f64e7ab9c26ccc0d0d32e7458745f2c70bffd352.tar.gz gnunet-f64e7ab9c26ccc0d0d32e7458745f2c70bffd352.zip |
changes ... more TBD
Diffstat (limited to 'src/ats-tool')
-rw-r--r-- | src/ats-tool/gnunet-ats.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c index 0ca28724a..27dfd4dca 100644 --- a/src/ats-tool/gnunet-ats.c +++ b/src/ats-tool/gnunet-ats.c | |||
@@ -178,31 +178,27 @@ void ats_perf_cb (void *cls, | |||
178 | { | 178 | { |
179 | struct PendingResolutions * pr; | 179 | struct PendingResolutions * pr; |
180 | 180 | ||
181 | pr = GNUNET_malloc (sizeof (struct PendingResolutions) + | ||
182 | ats_count * sizeof (struct GNUNET_ATS_Information)); | ||
183 | |||
184 | pr->ats_count = ats_count; | ||
185 | pr->ats = (struct GNUNET_ATS_Information *) &pr[1]; | ||
186 | if (ats_count > 0) | ||
187 | memcpy (pr->ats, ats, ats_count * sizeof (struct GNUNET_ATS_Information)); | ||
188 | pr->address = GNUNET_HELLO_address_copy (address); | ||
189 | pr->bandwidth_in = bandwidth_in; | ||
190 | pr->bandwidth_out = bandwidth_out; | ||
191 | pr->tats_ctx = GNUNET_TRANSPORT_address_to_string(cfg, address, | ||
192 | resolve_addresses_numeric, GNUNET_TIME_UNIT_FOREVER_REL, transport_addr_to_str_cb, pr); | ||
193 | GNUNET_CONTAINER_DLL_insert (head, tail, pr); | ||
194 | results++; | ||
195 | } | ||
196 | |||
197 | void la_cb (void *cls, | ||
198 | const struct GNUNET_HELLO_Address * address, | ||
199 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | ||
200 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | ||
201 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) | ||
202 | { | ||
203 | 181 | ||
182 | if (NULL != address) | ||
183 | { | ||
184 | pr = GNUNET_malloc (sizeof (struct PendingResolutions) + | ||
185 | ats_count * sizeof (struct GNUNET_ATS_Information)); | ||
186 | |||
187 | pr->ats_count = ats_count; | ||
188 | pr->ats = (struct GNUNET_ATS_Information *) &pr[1]; | ||
189 | if (ats_count > 0) | ||
190 | memcpy (pr->ats, ats, ats_count * sizeof (struct GNUNET_ATS_Information)); | ||
191 | pr->address = GNUNET_HELLO_address_copy (address); | ||
192 | pr->bandwidth_in = bandwidth_in; | ||
193 | pr->bandwidth_out = bandwidth_out; | ||
194 | pr->tats_ctx = GNUNET_TRANSPORT_address_to_string(cfg, address, | ||
195 | resolve_addresses_numeric, GNUNET_TIME_UNIT_FOREVER_REL, transport_addr_to_str_cb, pr); | ||
196 | GNUNET_CONTAINER_DLL_insert (head, tail, pr); | ||
197 | results++; | ||
198 | } | ||
204 | } | 199 | } |
205 | 200 | ||
201 | |||
206 | void end (void *cls, | 202 | void end (void *cls, |
207 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 203 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
208 | { | 204 | { |
@@ -289,7 +285,7 @@ void testservice_ats (void *cls, | |||
289 | 285 | ||
290 | alh = GNUNET_ATS_performance_list_addresses (ph, | 286 | alh = GNUNET_ATS_performance_list_addresses (ph, |
291 | (NULL == pid_str) ? NULL : &pid, | 287 | (NULL == pid_str) ? NULL : &pid, |
292 | GNUNET_YES, la_cb, NULL); | 288 | GNUNET_YES, ats_perf_cb, NULL); |
293 | if (NULL == alh) | 289 | if (NULL == alh) |
294 | { | 290 | { |
295 | fprintf (stderr, _("Cannot issue request to ATS service, exiting...\n")); | 291 | fprintf (stderr, _("Cannot issue request to ATS service, exiting...\n")); |
@@ -308,7 +304,7 @@ void testservice_ats (void *cls, | |||
308 | 304 | ||
309 | alh = GNUNET_ATS_performance_list_addresses (ph, | 305 | alh = GNUNET_ATS_performance_list_addresses (ph, |
310 | (NULL == pid_str) ? NULL : &pid, | 306 | (NULL == pid_str) ? NULL : &pid, |
311 | GNUNET_NO, la_cb, NULL); | 307 | GNUNET_NO, ats_perf_cb, NULL); |
312 | if (NULL == alh) | 308 | if (NULL == alh) |
313 | { | 309 | { |
314 | fprintf (stderr, _("Cannot issue request to ATS service, exiting...\n")); | 310 | fprintf (stderr, _("Cannot issue request to ATS service, exiting...\n")); |