aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-transport.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-02 22:25:48 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-02 22:25:48 +0000
commit69c3a52cfa679175da8f06bdcb8e2e4195465e44 (patch)
tree73109126cfcf1a807c5dc1e778f40b955fc959c5 /src/transport/gnunet-transport.c
parentc42deb089faffd654e27bf661ce85d5c1bb38b7a (diff)
downloadgnunet-69c3a52cfa679175da8f06bdcb8e2e4195465e44.tar.gz
gnunet-69c3a52cfa679175da8f06bdcb8e2e4195465e44.zip
avoid passing both PeerIdentity and Address (which contains PeerIdentity) if address is always present as then this is redundant
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r--src/transport/gnunet-transport.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index f20e11852..f90ce9005 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -67,11 +67,6 @@ struct ValidationResolutionContext
67 struct ValidationResolutionContext *prev; 67 struct ValidationResolutionContext *prev;
68 68
69 /** 69 /**
70 * Peer identity
71 */
72 struct GNUNET_PeerIdentity id;
73
74 /**
75 * Address to resolve 70 * Address to resolve
76 */ 71 */
77 struct GNUNET_HELLO_Address *addrcp; 72 struct GNUNET_HELLO_Address *addrcp;
@@ -745,7 +740,6 @@ result_callback (void *cls,
745/** 740/**
746 * Resolve address we got a validation state for to a string. 741 * Resolve address we got a validation state for to a string.
747 * 742 *
748 * @param id peer identity the address is for
749 * @param address the address itself 743 * @param address the address itself
750 * @param numeric #GNUNET_YES to disable DNS, #GNUNET_NO to try reverse lookup 744 * @param numeric #GNUNET_YES to disable DNS, #GNUNET_NO to try reverse lookup
751 * @param last_validation when was the address validated last 745 * @param last_validation when was the address validated last
@@ -754,8 +748,7 @@ result_callback (void *cls,
754 * @param state where are we in the validation state machine 748 * @param state where are we in the validation state machine
755 */ 749 */
756static void 750static void
757resolve_validation_address (const struct GNUNET_PeerIdentity *id, 751resolve_validation_address (const struct GNUNET_HELLO_Address *address,
758 const struct GNUNET_HELLO_Address *address,
759 int numeric, 752 int numeric,
760 struct GNUNET_TIME_Absolute last_validation, 753 struct GNUNET_TIME_Absolute last_validation,
761 struct GNUNET_TIME_Absolute valid_until, 754 struct GNUNET_TIME_Absolute valid_until,
@@ -795,7 +788,7 @@ process_validation_string (void *cls,
795 { 788 {
796 FPRINTF (stderr, 789 FPRINTF (stderr,
797 "Failed to convert address for peer `%s' plugin `%s' length %u to string \n", 790 "Failed to convert address for peer `%s' plugin `%s' length %u to string \n",
798 GNUNET_i2s (&vc->id), 791 GNUNET_i2s (&vc->addrcp->peer),
799 vc->addrcp->transport_name, 792 vc->addrcp->transport_name,
800 (unsigned int) vc->addrcp->address_length); 793 (unsigned int) vc->addrcp->address_length);
801 } 794 }
@@ -816,7 +809,7 @@ process_validation_string (void *cls,
816 809
817 FPRINTF (stdout, 810 FPRINTF (stdout,
818 _("Peer `%s' %s %s\n\t%s%s\n\t%s%s\n\t%s%s\n"), 811 _("Peer `%s' %s %s\n\t%s%s\n\t%s%s\n\t%s%s\n"),
819 GNUNET_i2s (&vc->id), 812 GNUNET_i2s (&vc->addrcp->peer),
820 (GNUNET_OK == res) ? address : "<invalid address>", 813 (GNUNET_OK == res) ? address : "<invalid address>",
821 (monitor_validation) ? GNUNET_TRANSPORT_vs2s (vc->state) : "", 814 (monitor_validation) ? GNUNET_TRANSPORT_vs2s (vc->state) : "",
822 "Valid until : ", s_valid, 815 "Valid until : ", s_valid,
@@ -840,8 +833,7 @@ process_validation_string (void *cls,
840 (note: this should be unnecessary, as 833 (note: this should be unnecessary, as
841 transport should fallback to numeric lookup 834 transport should fallback to numeric lookup
842 internally if DNS takes too long anyway) */ 835 internally if DNS takes too long anyway) */
843 resolve_validation_address (&vc->id, 836 resolve_validation_address (vc->addrcp,
844 vc->addrcp,
845 GNUNET_NO, 837 GNUNET_NO,
846 vc->last_validation, 838 vc->last_validation,
847 vc->valid_until, 839 vc->valid_until,
@@ -852,7 +844,7 @@ process_validation_string (void *cls,
852 { 844 {
853 FPRINTF (stdout, 845 FPRINTF (stdout,
854 _("Peer `%s' %s `%s' \n"), 846 _("Peer `%s' %s `%s' \n"),
855 GNUNET_i2s (&vc->id), 847 GNUNET_i2s (&vc->addrcp->peer),
856 "<unable to resolve address>", 848 "<unable to resolve address>",
857 GNUNET_TRANSPORT_vs2s (vc->state)); 849 GNUNET_TRANSPORT_vs2s (vc->state));
858 } 850 }
@@ -882,7 +874,6 @@ process_validation_string (void *cls,
882/** 874/**
883 * Resolve address we got a validation state for to a string. 875 * Resolve address we got a validation state for to a string.
884 * 876 *
885 * @param id peer identity the address is for
886 * @param address the address itself 877 * @param address the address itself
887 * @param numeric #GNUNET_YES to disable DNS, #GNUNET_NO to try reverse lookup 878 * @param numeric #GNUNET_YES to disable DNS, #GNUNET_NO to try reverse lookup
888 * @param last_validation when was the address validated last 879 * @param last_validation when was the address validated last
@@ -891,8 +882,7 @@ process_validation_string (void *cls,
891 * @param state where are we in the validation state machine 882 * @param state where are we in the validation state machine
892 */ 883 */
893static void 884static void
894resolve_validation_address (const struct GNUNET_PeerIdentity *id, 885resolve_validation_address (const struct GNUNET_HELLO_Address *address,
895 const struct GNUNET_HELLO_Address *address,
896 int numeric, 886 int numeric,
897 struct GNUNET_TIME_Absolute last_validation, 887 struct GNUNET_TIME_Absolute last_validation,
898 struct GNUNET_TIME_Absolute valid_until, 888 struct GNUNET_TIME_Absolute valid_until,
@@ -906,7 +896,6 @@ resolve_validation_address (const struct GNUNET_PeerIdentity *id,
906 GNUNET_CONTAINER_DLL_insert(vc_head, vc_tail, vc); 896 GNUNET_CONTAINER_DLL_insert(vc_head, vc_tail, vc);
907 address_resolutions++; 897 address_resolutions++;
908 898
909 vc->id = (*id);
910 vc->transport = GNUNET_strdup(address->transport_name); 899 vc->transport = GNUNET_strdup(address->transport_name);
911 vc->addrcp = GNUNET_HELLO_address_copy (address); 900 vc->addrcp = GNUNET_HELLO_address_copy (address);
912 vc->printed = GNUNET_NO; 901 vc->printed = GNUNET_NO;
@@ -928,7 +917,6 @@ resolve_validation_address (const struct GNUNET_PeerIdentity *id,
928 * Resolve address we got a validation state for to a string. 917 * Resolve address we got a validation state for to a string.
929 * 918 *
930 * @param cls NULL 919 * @param cls NULL
931 * @param peer peer identity the address is for
932 * @param address the address itself 920 * @param address the address itself
933 * @param last_validation when was the address validated last 921 * @param last_validation when was the address validated last
934 * @param valid_until until when is the address valid 922 * @param valid_until until when is the address valid
@@ -937,14 +925,13 @@ resolve_validation_address (const struct GNUNET_PeerIdentity *id,
937 */ 925 */
938static void 926static void
939process_validation_cb (void *cls, 927process_validation_cb (void *cls,
940 const struct GNUNET_PeerIdentity *peer,
941 const struct GNUNET_HELLO_Address *address, 928 const struct GNUNET_HELLO_Address *address,
942 struct GNUNET_TIME_Absolute last_validation, 929 struct GNUNET_TIME_Absolute last_validation,
943 struct GNUNET_TIME_Absolute valid_until, 930 struct GNUNET_TIME_Absolute valid_until,
944 struct GNUNET_TIME_Absolute next_validation, 931 struct GNUNET_TIME_Absolute next_validation,
945 enum GNUNET_TRANSPORT_ValidationState state) 932 enum GNUNET_TRANSPORT_ValidationState state)
946{ 933{
947 if ((NULL == peer) && (NULL == address)) 934 if (NULL == address)
948 { 935 {
949 if (monitor_validation) 936 if (monitor_validation)
950 { 937 {
@@ -961,7 +948,7 @@ process_validation_cb (void *cls,
961 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); 948 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
962 return; 949 return;
963 } 950 }
964 if ((NULL == peer) || (NULL == address)) 951 if (NULL == address)
965 { 952 {
966 /* invalid response */ 953 /* invalid response */
967 vic = NULL; 954 vic = NULL;
@@ -970,8 +957,7 @@ process_validation_cb (void *cls,
970 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); 957 end = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
971 return; 958 return;
972 } 959 }
973 resolve_validation_address (peer, 960 resolve_validation_address (address,
974 address,
975 numeric, 961 numeric,
976 last_validation, 962 last_validation,
977 valid_until, 963 valid_until,
@@ -1451,7 +1437,7 @@ resolve_peer_address (const struct GNUNET_PeerIdentity *id,
1451 GNUNET_CONTAINER_DLL_insert(rc_head, rc_tail, rc); 1437 GNUNET_CONTAINER_DLL_insert(rc_head, rc_tail, rc);
1452 address_resolutions++; 1438 address_resolutions++;
1453 1439
1454 rc->id = (*id); 1440 rc->id = *id;
1455 rc->transport = GNUNET_strdup(address->transport_name); 1441 rc->transport = GNUNET_strdup(address->transport_name);
1456 rc->addrcp = GNUNET_HELLO_address_copy (address); 1442 rc->addrcp = GNUNET_HELLO_address_copy (address);
1457 rc->printed = GNUNET_NO; 1443 rc->printed = GNUNET_NO;