diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-02 09:24:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-02 09:24:50 +0000 |
commit | 2806f183b7b07aa0b6060405d68b95c9243fa499 (patch) | |
tree | 7eb6c225cfe226f04cec58ef76e0a21c0b36363f /src/transport/gnunet-service-transport_validation.c | |
parent | 583fe23eac9e91896309c3d896af7541054d5e01 (diff) | |
download | gnunet-2806f183b7b07aa0b6060405d68b95c9243fa499.tar.gz gnunet-2806f183b7b07aa0b6060405d68b95c9243fa499.zip |
avoid duplication from storing PID in both address and in validation entry
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 8dd8e1989..59b99b8fc 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -195,11 +195,6 @@ struct ValidationEntry | |||
195 | struct GNUNET_CRYPTO_EddsaPublicKey public_key; | 195 | struct GNUNET_CRYPTO_EddsaPublicKey public_key; |
196 | 196 | ||
197 | /** | 197 | /** |
198 | * The identity of the peer. FIXME: duplicated (also in 'address') | ||
199 | */ | ||
200 | struct GNUNET_PeerIdentity pid; | ||
201 | |||
202 | /** | ||
203 | * Cached PONG signature | 198 | * Cached PONG signature |
204 | */ | 199 | */ |
205 | struct GNUNET_CRYPTO_EddsaSignature pong_sig_cache; | 200 | struct GNUNET_CRYPTO_EddsaSignature pong_sig_cache; |
@@ -415,7 +410,7 @@ validation_entry_changed (struct ValidationEntry *ve, | |||
415 | enum GNUNET_TRANSPORT_ValidationState state) | 410 | enum GNUNET_TRANSPORT_ValidationState state) |
416 | { | 411 | { |
417 | ve->state = state; | 412 | ve->state = state; |
418 | GST_clients_broadcast_validation_notification (&ve->pid, | 413 | GST_clients_broadcast_validation_notification (&ve->address->peer, |
419 | ve->address, | 414 | ve->address, |
420 | ve->send_time, | 415 | ve->send_time, |
421 | ve->valid_until, | 416 | ve->valid_until, |
@@ -452,7 +447,8 @@ cleanup_validation_entry (void *cls, | |||
452 | } | 447 | } |
453 | GNUNET_break (GNUNET_OK == | 448 | GNUNET_break (GNUNET_OK == |
454 | GNUNET_CONTAINER_multipeermap_remove (validation_map, | 449 | GNUNET_CONTAINER_multipeermap_remove (validation_map, |
455 | &ve->pid, ve)); | 450 | &ve->address->peer, |
451 | ve)); | ||
456 | if (GNUNET_YES == ve->known_to_ats) | 452 | if (GNUNET_YES == ve->known_to_ats) |
457 | { | 453 | { |
458 | GST_ats_expire_address (ve->address); | 454 | GST_ats_expire_address (ve->address); |
@@ -515,7 +511,7 @@ timeout_hello_validation (void *cls, | |||
515 | GNUNET_STATISTICS_update (GST_stats, | 511 | GNUNET_STATISTICS_update (GST_stats, |
516 | gettext_noop ("# address records discarded"), 1, | 512 | gettext_noop ("# address records discarded"), 1, |
517 | GNUNET_NO); | 513 | GNUNET_NO); |
518 | cleanup_validation_entry (NULL, &ve->pid, ve); | 514 | cleanup_validation_entry (NULL, &ve->address->peer, ve); |
519 | } | 515 | } |
520 | 516 | ||
521 | 517 | ||
@@ -759,7 +755,7 @@ revalidate_address (void *cls, | |||
759 | GNUNET_STATISTICS_update (GST_stats, | 755 | GNUNET_STATISTICS_update (GST_stats, |
760 | gettext_noop ("# address revalidations started"), 1, | 756 | gettext_noop ("# address revalidations started"), 1, |
761 | GNUNET_NO); | 757 | GNUNET_NO); |
762 | bc = GST_blacklist_test_allowed (&ve->pid, | 758 | bc = GST_blacklist_test_allowed (&ve->address->peer, |
763 | ve->address->transport_name, | 759 | ve->address->transport_name, |
764 | &transmit_ping_if_allowed, ve); | 760 | &transmit_ping_if_allowed, ve); |
765 | if (NULL != bc) | 761 | if (NULL != bc) |
@@ -798,7 +794,6 @@ find_validation_entry (const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, | |||
798 | ve->in_use = GNUNET_SYSERR; /* not defined */ | 794 | ve->in_use = GNUNET_SYSERR; /* not defined */ |
799 | ve->address = GNUNET_HELLO_address_copy (address); | 795 | ve->address = GNUNET_HELLO_address_copy (address); |
800 | ve->public_key = *public_key; | 796 | ve->public_key = *public_key; |
801 | ve->pid = address->peer; | ||
802 | ve->pong_sig_valid_until = GNUNET_TIME_absolute_get_zero_(); | 797 | ve->pong_sig_valid_until = GNUNET_TIME_absolute_get_zero_(); |
803 | memset (&ve->pong_sig_cache, '\0', sizeof (struct GNUNET_CRYPTO_EddsaSignature)); | 798 | memset (&ve->pong_sig_cache, '\0', sizeof (struct GNUNET_CRYPTO_EddsaSignature)); |
804 | ve->latency = GNUNET_TIME_UNIT_FOREVER_REL; | 799 | ve->latency = GNUNET_TIME_UNIT_FOREVER_REL; |
@@ -1442,7 +1437,9 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1442 | return GNUNET_OK; | 1437 | return GNUNET_OK; |
1443 | } | 1438 | } |
1444 | /* now check that PONG is well-formed */ | 1439 | /* now check that PONG is well-formed */ |
1445 | if (0 != memcmp (&ve->pid, sender, sizeof (struct GNUNET_PeerIdentity))) | 1440 | if (0 != memcmp (&ve->address->peer, |
1441 | sender, | ||
1442 | sizeof (struct GNUNET_PeerIdentity))) | ||
1446 | { | 1443 | { |
1447 | GNUNET_break_op (0); | 1444 | GNUNET_break_op (0); |
1448 | return GNUNET_SYSERR; | 1445 | return GNUNET_SYSERR; |
@@ -1795,10 +1792,10 @@ validation_entries_iterate (void *cls, | |||
1795 | 1792 | ||
1796 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1793 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1797 | "Notifying about validation entry for peer `%s' address `%s' \n", | 1794 | "Notifying about validation entry for peer `%s' address `%s' \n", |
1798 | GNUNET_i2s (&ve->pid), | 1795 | GNUNET_i2s (&ve->address->peer), |
1799 | GST_plugins_a2s (ve->address)); | 1796 | GST_plugins_a2s (ve->address)); |
1800 | ic->cb (ic->cb_cls, | 1797 | ic->cb (ic->cb_cls, |
1801 | &ve->pid, | 1798 | &ve->address->peer, |
1802 | ve->address, | 1799 | ve->address, |
1803 | ve->send_time, | 1800 | ve->send_time, |
1804 | ve->valid_until, | 1801 | ve->valid_until, |