diff options
-rw-r--r-- | src/ats-tests/ats-testing.c | 2 | ||||
-rw-r--r-- | src/ats-tool/gnunet-ats.c | 96 | ||||
-rw-r--r-- | src/ats/ats_api_performance.c | 10 | ||||
-rw-r--r-- | src/ats/perf_ats_solver.c | 2 | ||||
-rw-r--r-- | src/ats/test_ats_api_bandwidth_consumption.c | 2 | ||||
-rw-r--r-- | src/ats/test_ats_api_performance_monitor.c | 4 | ||||
-rw-r--r-- | src/ats/test_ats_api_performance_monitor_initial_callback.c | 3 | ||||
-rw-r--r-- | src/ats/test_ats_solver_preferences.c | 3 | ||||
-rw-r--r-- | src/dv/gnunet-service-dv.c | 6 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs.c | 6 | ||||
-rw-r--r-- | src/include/gnunet_ats_service.h | 10 | ||||
-rw-r--r-- | src/include/gnunet_nat_lib.h | 2 | ||||
-rw-r--r-- | src/testbed/gnunet-daemon-latency-logger.c | 6 |
13 files changed, 118 insertions, 34 deletions
diff --git a/src/ats-tests/ats-testing.c b/src/ats-tests/ats-testing.c index 49c3c841b..6fda20311 100644 --- a/src/ats-tests/ats-testing.c +++ b/src/ats-tests/ats-testing.c | |||
@@ -556,6 +556,8 @@ ats_performance_info_cb (void *cls, | |||
556 | int log; | 556 | int log; |
557 | char *peer_id; | 557 | char *peer_id; |
558 | 558 | ||
559 | |||
560 | |||
559 | p = find_partner (me, &address->peer); | 561 | p = find_partner (me, &address->peer); |
560 | if (NULL == p) | 562 | if (NULL == p) |
561 | { | 563 | { |
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c index 56f8a17ac..83b9739ff 100644 --- a/src/ats-tool/gnunet-ats.c +++ b/src/ats-tool/gnunet-ats.c | |||
@@ -288,14 +288,33 @@ find_address_it (void *cls, | |||
288 | } | 288 | } |
289 | 289 | ||
290 | static void | 290 | static void |
291 | ats_perf_cb(void *cls, const struct GNUNET_HELLO_Address *address, int active, | 291 | ats_perf_mon_cb(void *cls, const struct GNUNET_HELLO_Address *address, int active, |
292 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 292 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
293 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 293 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
294 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) | 294 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) |
295 | { | 295 | { |
296 | struct PendingResolutions * pr; | 296 | struct PendingResolutions *pr; |
297 | struct PendingResolutions *cur; | ||
298 | struct PendingResolutions *next; | ||
297 | 299 | ||
298 | if ((GNUNET_YES == op_monitor) && (GNUNET_NO == verbose)) | 300 | if (NULL == address) |
301 | { | ||
302 | /* ATS service temporarily disconnected, remove current state */ | ||
303 | next = head; | ||
304 | for (cur = next; NULL != cur; cur = next) | ||
305 | { | ||
306 | next = cur->next; | ||
307 | GNUNET_CONTAINER_DLL_remove (head, tail, cur); | ||
308 | GNUNET_TRANSPORT_address_to_string_cancel (cur->tats_ctx); | ||
309 | GNUNET_HELLO_address_free (cur->address); | ||
310 | GNUNET_free (cur); | ||
311 | } | ||
312 | |||
313 | GNUNET_CONTAINER_multipeermap_iterate(addresses, &free_addr_it, NULL); | ||
314 | return; | ||
315 | } | ||
316 | |||
317 | if (GNUNET_NO == verbose) | ||
299 | { | 318 | { |
300 | struct AddressFindCtx actx; | 319 | struct AddressFindCtx actx; |
301 | 320 | ||
@@ -316,7 +335,6 @@ ats_perf_cb(void *cls, const struct GNUNET_HELLO_Address *address, int active, | |||
316 | actx.res->bandwidth_out = bandwidth_out; | 335 | actx.res->bandwidth_out = bandwidth_out; |
317 | } | 336 | } |
318 | } | 337 | } |
319 | |||
320 | struct ATSAddress *a = GNUNET_new (struct ATSAddress); | 338 | struct ATSAddress *a = GNUNET_new (struct ATSAddress); |
321 | a->address = GNUNET_HELLO_address_copy(address); | 339 | a->address = GNUNET_HELLO_address_copy(address); |
322 | a->bandwidth_in = bandwidth_in; | 340 | a->bandwidth_in = bandwidth_in; |
@@ -325,27 +343,35 @@ ats_perf_cb(void *cls, const struct GNUNET_HELLO_Address *address, int active, | |||
325 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 343 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
326 | } | 344 | } |
327 | 345 | ||
328 | if (NULL != address) | 346 | pr = GNUNET_malloc (sizeof (struct PendingResolutions) + |
329 | { | 347 | ats_count * sizeof (struct GNUNET_ATS_Information)); |
330 | pr = GNUNET_malloc (sizeof (struct PendingResolutions) + | 348 | |
331 | ats_count * sizeof (struct GNUNET_ATS_Information)); | 349 | pr->ats_count = ats_count; |
332 | 350 | pr->ats = (struct GNUNET_ATS_Information *) &pr[1]; | |
333 | pr->ats_count = ats_count; | 351 | if (ats_count > 0) |
334 | pr->ats = (struct GNUNET_ATS_Information *) &pr[1]; | 352 | memcpy (pr->ats, ats, ats_count * sizeof(struct GNUNET_ATS_Information)); |
335 | if (ats_count > 0) | 353 | pr->address = GNUNET_HELLO_address_copy (address); |
336 | memcpy (pr->ats, ats, ats_count * sizeof(struct GNUNET_ATS_Information)); | 354 | pr->bandwidth_in = bandwidth_in; |
337 | pr->address = GNUNET_HELLO_address_copy (address); | 355 | pr->bandwidth_out = bandwidth_out; |
338 | pr->bandwidth_in = bandwidth_in; | 356 | pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address, |
339 | pr->bandwidth_out = bandwidth_out; | 357 | resolve_addresses_numeric, |
340 | pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address, | 358 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), |
341 | resolve_addresses_numeric, | 359 | transport_addr_to_str_cb, pr); |
342 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), | 360 | GNUNET_CONTAINER_DLL_insert (head, tail, pr); |
343 | transport_addr_to_str_cb, pr); | 361 | results++; |
344 | GNUNET_CONTAINER_DLL_insert(head, tail, pr); | 362 | pending++; |
345 | results++; | 363 | } |
346 | pending++; | 364 | |
347 | } | 365 | |
348 | else | 366 | static void |
367 | ats_perf_cb(void *cls, const struct GNUNET_HELLO_Address *address, int active, | ||
368 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | ||
369 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | ||
370 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) | ||
371 | { | ||
372 | struct PendingResolutions * pr; | ||
373 | |||
374 | if (NULL == address) | ||
349 | { | 375 | { |
350 | /* All messages received */ | 376 | /* All messages received */ |
351 | receive_done = GNUNET_YES; | 377 | receive_done = GNUNET_YES; |
@@ -358,6 +384,24 @@ ats_perf_cb(void *cls, const struct GNUNET_HELLO_Address *address, int active, | |||
358 | end_task = GNUNET_SCHEDULER_add_now (end, NULL ); | 384 | end_task = GNUNET_SCHEDULER_add_now (end, NULL ); |
359 | } | 385 | } |
360 | } | 386 | } |
387 | |||
388 | pr = GNUNET_malloc (sizeof (struct PendingResolutions) + | ||
389 | ats_count * sizeof (struct GNUNET_ATS_Information)); | ||
390 | |||
391 | pr->ats_count = ats_count; | ||
392 | pr->ats = (struct GNUNET_ATS_Information *) &pr[1]; | ||
393 | if (ats_count > 0) | ||
394 | memcpy (pr->ats, ats, ats_count * sizeof(struct GNUNET_ATS_Information)); | ||
395 | pr->address = GNUNET_HELLO_address_copy (address); | ||
396 | pr->bandwidth_in = bandwidth_in; | ||
397 | pr->bandwidth_out = bandwidth_out; | ||
398 | pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address, | ||
399 | resolve_addresses_numeric, | ||
400 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), | ||
401 | transport_addr_to_str_cb, pr); | ||
402 | GNUNET_CONTAINER_DLL_insert(head, tail, pr); | ||
403 | results++; | ||
404 | pending++; | ||
361 | } | 405 | } |
362 | 406 | ||
363 | static unsigned int | 407 | static unsigned int |
@@ -510,7 +554,7 @@ testservice_ats(void *cls, int result) | |||
510 | } | 554 | } |
511 | else if (op_monitor) | 555 | else if (op_monitor) |
512 | { | 556 | { |
513 | ph = GNUNET_ATS_performance_init (cfg, &ats_perf_cb, NULL ); | 557 | ph = GNUNET_ATS_performance_init (cfg, &ats_perf_mon_cb, NULL ); |
514 | if (NULL == ph) | 558 | if (NULL == ph) |
515 | fprintf (stderr, _("Cannot connect to ATS service, exiting...\n") ); | 559 | fprintf (stderr, _("Cannot connect to ATS service, exiting...\n") ); |
516 | end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &end, | 560 | end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &end, |
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c index a1d8dc21a..35dcc558f 100644 --- a/src/ats/ats_api_performance.c +++ b/src/ats/ats_api_performance.c | |||
@@ -587,6 +587,7 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg) | |||
587 | GNUNET_CLIENT_receive (ph->client, &process_ats_message, ph, | 587 | GNUNET_CLIENT_receive (ph->client, &process_ats_message, ph, |
588 | GNUNET_TIME_UNIT_FOREVER_REL); | 588 | GNUNET_TIME_UNIT_FOREVER_REL); |
589 | return; | 589 | return; |
590 | |||
590 | reconnect: | 591 | reconnect: |
591 | if (NULL != ph->th) | 592 | if (NULL != ph->th) |
592 | { | 593 | { |
@@ -595,7 +596,14 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg) | |||
595 | } | 596 | } |
596 | GNUNET_CLIENT_disconnect (ph->client); | 597 | GNUNET_CLIENT_disconnect (ph->client); |
597 | ph->client = NULL; | 598 | ph->client = NULL; |
598 | /* FIXME: need to signal monitor that we were disconnected! */ | 599 | if (NULL != ph->addr_info_cb) |
600 | { | ||
601 | /* Indicate reconnect */ | ||
602 | ph->addr_info_cb (ph->addr_info_cb_cls, NULL, GNUNET_NO, | ||
603 | GNUNET_BANDWIDTH_value_init (0), | ||
604 | GNUNET_BANDWIDTH_value_init(0), | ||
605 | NULL, 0); | ||
606 | } | ||
599 | ph->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 607 | ph->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
600 | &reconnect_task, ph); | 608 | &reconnect_task, ph); |
601 | } | 609 | } |
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index a5307028d..4e1e68c23 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_statistics_service.h" | 28 | #include "gnunet_statistics_service.h" |
29 | #include "gnunet-service-ats_addresses.h" | 29 | #include "gnunet-service-ats_addresses.h" |
30 | 30 | #include "gnunet-service-ats_normalization.h" | |
31 | #include "gnunet_ats_service.h" | 31 | #include "gnunet_ats_service.h" |
32 | #include "gnunet_ats_plugin.h" | 32 | #include "gnunet_ats_plugin.h" |
33 | #include "test_ats_api_common.h" | 33 | #include "test_ats_api_common.h" |
diff --git a/src/ats/test_ats_api_bandwidth_consumption.c b/src/ats/test_ats_api_bandwidth_consumption.c index 493323657..b05a7cf22 100644 --- a/src/ats/test_ats_api_bandwidth_consumption.c +++ b/src/ats/test_ats_api_bandwidth_consumption.c | |||
@@ -192,7 +192,7 @@ run (void *cls, | |||
192 | p = GNUNET_new (struct PeerContext); | 192 | p = GNUNET_new (struct PeerContext); |
193 | addr = GNUNET_new (struct Address); | 193 | addr = GNUNET_new (struct Address); |
194 | 194 | ||
195 | atp = GNUNET_ATS_performance_init (cfg, &performance_cb, NULL); | 195 | atp = GNUNET_ATS_performance_init (cfg, NULL, NULL); |
196 | if (atp == NULL) | 196 | if (atp == NULL) |
197 | { | 197 | { |
198 | ret = GNUNET_SYSERR; | 198 | ret = GNUNET_SYSERR; |
diff --git a/src/ats/test_ats_api_performance_monitor.c b/src/ats/test_ats_api_performance_monitor.c index 6ccac45d1..4b6b08b74 100644 --- a/src/ats/test_ats_api_performance_monitor.c +++ b/src/ats/test_ats_api_performance_monitor.c | |||
@@ -106,6 +106,10 @@ ats_perf_cb (void *cls, | |||
106 | static int peer0 = GNUNET_NO; | 106 | static int peer0 = GNUNET_NO; |
107 | static int peer1 = GNUNET_NO; | 107 | static int peer1 = GNUNET_NO; |
108 | static int done = GNUNET_NO; | 108 | static int done = GNUNET_NO; |
109 | |||
110 | if (NULL == address) | ||
111 | return; | ||
112 | |||
109 | if ((GNUNET_NO == peer0) && (0 == memcmp (address, &p[0].id, sizeof (p[0].id)))) | 113 | if ((GNUNET_NO == peer0) && (0 == memcmp (address, &p[0].id, sizeof (p[0].id)))) |
110 | { | 114 | { |
111 | peer0 = GNUNET_YES; | 115 | peer0 = GNUNET_YES; |
diff --git a/src/ats/test_ats_api_performance_monitor_initial_callback.c b/src/ats/test_ats_api_performance_monitor_initial_callback.c index 6d305d3a5..377686673 100644 --- a/src/ats/test_ats_api_performance_monitor_initial_callback.c +++ b/src/ats/test_ats_api_performance_monitor_initial_callback.c | |||
@@ -107,6 +107,9 @@ ats_perf_cb (void *cls, | |||
107 | static int peer1 = GNUNET_NO; | 107 | static int peer1 = GNUNET_NO; |
108 | static int done = GNUNET_NO; | 108 | static int done = GNUNET_NO; |
109 | 109 | ||
110 | if (NULL == address) | ||
111 | return; | ||
112 | |||
110 | if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id))) | 113 | if (0 == memcmp (&address->peer, &p[0].id, sizeof (p[0].id))) |
111 | { | 114 | { |
112 | peer0 ++; | 115 | peer0 ++; |
diff --git a/src/ats/test_ats_solver_preferences.c b/src/ats/test_ats_solver_preferences.c index 117af470b..4de3d9a5b 100644 --- a/src/ats/test_ats_solver_preferences.c +++ b/src/ats/test_ats_solver_preferences.c | |||
@@ -145,6 +145,9 @@ perf_info_cb (void *cls, | |||
145 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 145 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
146 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) | 146 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) |
147 | { | 147 | { |
148 | if (NULL == address) | ||
149 | return; | ||
150 | |||
148 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "ATS performance info: `%s'\n", | 151 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "ATS performance info: `%s'\n", |
149 | GNUNET_i2s (&address->peer)); | 152 | GNUNET_i2s (&address->peer)); |
150 | } | 153 | } |
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index a3d6e4942..67db7072b 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -1321,6 +1321,12 @@ handle_ats_update (void *cls, | |||
1321 | uint32_t distance; | 1321 | uint32_t distance; |
1322 | enum GNUNET_ATS_Network_Type network = GNUNET_ATS_NET_UNSPECIFIED; | 1322 | enum GNUNET_ATS_Network_Type network = GNUNET_ATS_NET_UNSPECIFIED; |
1323 | 1323 | ||
1324 | if (NULL == address) | ||
1325 | { | ||
1326 | /* ATS service temporarily disconnected */ | ||
1327 | return; | ||
1328 | } | ||
1329 | |||
1324 | if (GNUNET_NO == active) | 1330 | if (GNUNET_NO == active) |
1325 | return; | 1331 | return; |
1326 | distance = get_atsi_distance (ats, ats_count); | 1332 | distance = get_atsi_distance (ats, ats_count); |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 59786bae8..fd776e7b8 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -254,6 +254,12 @@ update_latencies (void *cls, | |||
254 | unsigned int i; | 254 | unsigned int i; |
255 | struct GNUNET_TIME_Relative latency; | 255 | struct GNUNET_TIME_Relative latency; |
256 | 256 | ||
257 | if (NULL == address) | ||
258 | { | ||
259 | /* ATS service temporarily disconnected */ | ||
260 | return; | ||
261 | } | ||
262 | |||
257 | if (GNUNET_YES != active) | 263 | if (GNUNET_YES != active) |
258 | return; | 264 | return; |
259 | for (i = 0; i < ats_count; i++) | 265 | for (i = 0; i < ats_count; i++) |
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index 0268391cd..eeb9eec38 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h | |||
@@ -756,9 +756,9 @@ struct GNUNET_ATS_PerformanceHandle; | |||
756 | * Signature of a function that is called with QoS information about an address. | 756 | * Signature of a function that is called with QoS information about an address. |
757 | * | 757 | * |
758 | * @param cls closure | 758 | * @param cls closure |
759 | * @param address the address | 759 | * @param address the address, NULL if ATS service was disconnected |
760 | * @param address_active is this address actively used to maintain a connection | 760 | * @param address_active is this address actively used to maintain a connection |
761 | * to a peer | 761 | to a peer |
762 | * @param bandwidth_out assigned outbound bandwidth for the connection | 762 | * @param bandwidth_out assigned outbound bandwidth for the connection |
763 | * @param bandwidth_in assigned inbound bandwidth for the connection | 763 | * @param bandwidth_in assigned inbound bandwidth for the connection |
764 | * @param ats performance data for the address (as far as known) | 764 | * @param ats performance data for the address (as far as known) |
@@ -766,10 +766,12 @@ struct GNUNET_ATS_PerformanceHandle; | |||
766 | */ | 766 | */ |
767 | typedef void | 767 | typedef void |
768 | (*GNUNET_ATS_AddressInformationCallback) (void *cls, | 768 | (*GNUNET_ATS_AddressInformationCallback) (void *cls, |
769 | const struct GNUNET_HELLO_Address *address, int address_active, | 769 | const struct GNUNET_HELLO_Address *address, |
770 | int address_active, | ||
770 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 771 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
771 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 772 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
772 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count); | 773 | const struct GNUNET_ATS_Information *ats, |
774 | uint32_t ats_count); | ||
773 | 775 | ||
774 | /** | 776 | /** |
775 | * Handle for an address listing operation | 777 | * Handle for an address listing operation |
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h index f81fe485a..7509bb64d 100644 --- a/src/include/gnunet_nat_lib.h +++ b/src/include/gnunet_nat_lib.h | |||
@@ -297,7 +297,7 @@ struct GNUNET_NAT_MiniHandle; | |||
297 | * | 297 | * |
298 | * @param cls closure | 298 | * @param cls closure |
299 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean | 299 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean |
300 | * the previous (now invalid) one | 300 | * the previous (now invalid) one, #GNUNET_SYSERR indicates an error |
301 | * @param addr either the previous or the new public IP address | 301 | * @param addr either the previous or the new public IP address |
302 | * @param addrlen actual length of the @a addr | 302 | * @param addrlen actual length of the @a addr |
303 | * @param result GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | 303 | * @param result GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code |
diff --git a/src/testbed/gnunet-daemon-latency-logger.c b/src/testbed/gnunet-daemon-latency-logger.c index bac89deee..774b5dd4d 100644 --- a/src/testbed/gnunet-daemon-latency-logger.c +++ b/src/testbed/gnunet-daemon-latency-logger.c | |||
@@ -190,6 +190,12 @@ addr_info_cb (void *cls, | |||
190 | int latency; | 190 | int latency; |
191 | unsigned int cnt; | 191 | unsigned int cnt; |
192 | 192 | ||
193 | if (NULL == address) | ||
194 | { | ||
195 | /* ATS service temporarily disconnected */ | ||
196 | return; | ||
197 | } | ||
198 | |||
193 | GNUNET_assert (NULL != db); | 199 | GNUNET_assert (NULL != db); |
194 | if (GNUNET_NO == address_active) | 200 | if (GNUNET_NO == address_active) |
195 | return; | 201 | return; |