diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-07 11:54:46 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-07 11:54:46 +0000 |
commit | fd77112f5b46f75e4eb9bf155fb8052c0d79f77a (patch) | |
tree | 9808e06ede4d1d7bba0aeabd4a79d6e175da563e | |
parent | 4855e879c0203915789e4e49f6b6a658150a6626 (diff) | |
download | gnunet-fd77112f5b46f75e4eb9bf155fb8052c0d79f77a.tar.gz gnunet-fd77112f5b46f75e4eb9bf155fb8052c0d79f77a.zip |
add additional diagnostics to help localize #3971 invariant violation
-rw-r--r-- | src/transport/gnunet-service-transport_ats.c | 17 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_ats.h | 14 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 12 |
3 files changed, 39 insertions, 4 deletions
diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c index 55b5e20a1..74658822e 100644 --- a/src/transport/gnunet-service-transport_ats.c +++ b/src/transport/gnunet-service-transport_ats.c | |||
@@ -249,11 +249,11 @@ find_ai_no_session (const struct GNUNET_HELLO_Address *address) | |||
249 | 249 | ||
250 | 250 | ||
251 | /** | 251 | /** |
252 | * Test if ATS knows about this address. | 252 | * Test if ATS knows about this @a address and @a session. |
253 | * | 253 | * |
254 | * @param address the address | 254 | * @param address the address |
255 | * @param session the session | 255 | * @param session the session |
256 | * @return #GNUNET_YES if address is known, #GNUNET_NO if not. | 256 | * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not. |
257 | */ | 257 | */ |
258 | int | 258 | int |
259 | GST_ats_is_known (const struct GNUNET_HELLO_Address *address, | 259 | GST_ats_is_known (const struct GNUNET_HELLO_Address *address, |
@@ -264,6 +264,19 @@ GST_ats_is_known (const struct GNUNET_HELLO_Address *address, | |||
264 | 264 | ||
265 | 265 | ||
266 | /** | 266 | /** |
267 | * Test if ATS knows about this @a address. | ||
268 | * | ||
269 | * @param address the address | ||
270 | * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not. | ||
271 | */ | ||
272 | int | ||
273 | GST_ats_is_known_no_session (const struct GNUNET_HELLO_Address *address) | ||
274 | { | ||
275 | return (NULL != find_ai_no_session (address)) ? GNUNET_YES : GNUNET_NO; | ||
276 | } | ||
277 | |||
278 | |||
279 | /** | ||
267 | * The blocking time for an address has expired, allow ATS to | 280 | * The blocking time for an address has expired, allow ATS to |
268 | * suggest it again. | 281 | * suggest it again. |
269 | * | 282 | * |
diff --git a/src/transport/gnunet-service-transport_ats.h b/src/transport/gnunet-service-transport_ats.h index 323191a4d..de0800d0a 100644 --- a/src/transport/gnunet-service-transport_ats.h +++ b/src/transport/gnunet-service-transport_ats.h | |||
@@ -42,11 +42,11 @@ GST_ats_done (void); | |||
42 | 42 | ||
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Test if ATS knows about this address. | 45 | * Test if ATS knows about this @a address and @a session. |
46 | * | 46 | * |
47 | * @param address the address | 47 | * @param address the address |
48 | * @param session the session | 48 | * @param session the session |
49 | * @return #GNUNET_YES if address is known, #GNUNET_NO if not. | 49 | * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not. |
50 | */ | 50 | */ |
51 | int | 51 | int |
52 | GST_ats_is_known (const struct GNUNET_HELLO_Address *address, | 52 | GST_ats_is_known (const struct GNUNET_HELLO_Address *address, |
@@ -54,6 +54,16 @@ GST_ats_is_known (const struct GNUNET_HELLO_Address *address, | |||
54 | 54 | ||
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Test if ATS knows about this @a address. | ||
58 | * | ||
59 | * @param address the address | ||
60 | * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not. | ||
61 | */ | ||
62 | int | ||
63 | GST_ats_is_known_no_session (const struct GNUNET_HELLO_Address *address); | ||
64 | |||
65 | |||
66 | /** | ||
57 | * Temporarily block a valid address for use by ATS for address | 67 | * Temporarily block a valid address for use by ATS for address |
58 | * suggestions. This function should be called if an address was | 68 | * suggestions. This function should be called if an address was |
59 | * suggested by ATS but failed to perform (i.e. failure to establish a | 69 | * suggested by ATS but failed to perform (i.e. failure to establish a |
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 314eefaec..66f9f5409 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -429,6 +429,8 @@ cleanup_validation_entry (void *cls, | |||
429 | if (GNUNET_YES == ve->known_to_ats) | 429 | if (GNUNET_YES == ve->known_to_ats) |
430 | { | 430 | { |
431 | GST_ats_expire_address (ve->address); | 431 | GST_ats_expire_address (ve->address); |
432 | GNUNET_assert (GNUNET_NO == | ||
433 | GST_ats_is_known_no_session (ve->address)); | ||
432 | ve->known_to_ats = GNUNET_NO; | 434 | ve->known_to_ats = GNUNET_NO; |
433 | } | 435 | } |
434 | GNUNET_HELLO_address_free (ve->address); | 436 | GNUNET_HELLO_address_free (ve->address); |
@@ -781,6 +783,8 @@ find_validation_entry (const struct GNUNET_HELLO_Address *address) | |||
781 | &validation_entry_match, &vemc); | 783 | &validation_entry_match, &vemc); |
782 | if (NULL != (ve = vemc.ve)) | 784 | if (NULL != (ve = vemc.ve)) |
783 | return ve; | 785 | return ve; |
786 | GNUNET_assert (GNUNET_NO == | ||
787 | GST_ats_is_known_no_session (address)); | ||
784 | ve = GNUNET_new (struct ValidationEntry); | 788 | ve = GNUNET_new (struct ValidationEntry); |
785 | ve->in_use = GNUNET_SYSERR; /* not defined */ | 789 | ve->in_use = GNUNET_SYSERR; /* not defined */ |
786 | ve->address = GNUNET_HELLO_address_copy (address); | 790 | ve->address = GNUNET_HELLO_address_copy (address); |
@@ -859,6 +863,8 @@ add_valid_address (void *cls, | |||
859 | { | 863 | { |
860 | ve->known_to_ats = GNUNET_YES; | 864 | ve->known_to_ats = GNUNET_YES; |
861 | GST_ats_add_address (address, &prop); | 865 | GST_ats_add_address (address, &prop); |
866 | GNUNET_assert (GNUNET_YES == | ||
867 | GST_ats_is_known_no_session (ve->address)); | ||
862 | } | 868 | } |
863 | return GNUNET_OK; | 869 | return GNUNET_OK; |
864 | } | 870 | } |
@@ -1490,6 +1496,8 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1490 | { | 1496 | { |
1491 | if (GNUNET_YES == ve->known_to_ats) | 1497 | if (GNUNET_YES == ve->known_to_ats) |
1492 | { | 1498 | { |
1499 | GNUNET_assert (GNUNET_YES == | ||
1500 | GST_ats_is_known_no_session (ve->address)); | ||
1493 | GST_ats_update_delay (ve->address, | 1501 | GST_ats_update_delay (ve->address, |
1494 | GNUNET_TIME_relative_divide (ve->latency, 2)); | 1502 | GNUNET_TIME_relative_divide (ve->latency, 2)); |
1495 | } | 1503 | } |
@@ -1500,8 +1508,12 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1500 | memset (&prop, 0, sizeof (prop)); | 1508 | memset (&prop, 0, sizeof (prop)); |
1501 | prop.scope = ve->network; | 1509 | prop.scope = ve->network; |
1502 | prop.delay = GNUNET_TIME_relative_divide (ve->latency, 2); | 1510 | prop.delay = GNUNET_TIME_relative_divide (ve->latency, 2); |
1511 | GNUNET_assert (GNUNET_NO == | ||
1512 | GST_ats_is_known_no_session (ve->address)); | ||
1503 | ve->known_to_ats = GNUNET_YES; | 1513 | ve->known_to_ats = GNUNET_YES; |
1504 | GST_ats_add_address (ve->address, &prop); | 1514 | GST_ats_add_address (ve->address, &prop); |
1515 | GNUNET_assert (GNUNET_YES == | ||
1516 | GST_ats_is_known_no_session (ve->address)); | ||
1505 | } | 1517 | } |
1506 | } | 1518 | } |
1507 | if (validations_running > 0) | 1519 | if (validations_running > 0) |