diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-04-02 11:20:40 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-04-02 11:20:40 +0000 |
commit | 26db97ede7c7a73fc7389479109fdc42aa0257d3 (patch) | |
tree | ae18202174f2a334f50c788565648647b08555f0 /src/transport/plugin_transport_http.c | |
parent | 04dfdb6bd627565890b11094967487fecdd802e8 (diff) | |
download | gnunet-26db97ede7c7a73fc7389479109fdc42aa0257d3.tar.gz gnunet-26db97ede7c7a73fc7389479109fdc42aa0257d3.zip |
fixing 0002249: report only new addresses
Diffstat (limited to 'src/transport/plugin_transport_http.c')
-rw-r--r-- | src/transport/plugin_transport_http.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index ec89393cf..2518dac5c 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -873,8 +873,7 @@ find_address (struct Plugin *plugin, const struct sockaddr *addr, socklen_t addr | |||
873 | default: | 873 | default: |
874 | return NULL; | 874 | return NULL; |
875 | } | 875 | } |
876 | 876 | return NULL; | |
877 | |||
878 | } | 877 | } |
879 | 878 | ||
880 | static void | 879 | static void |
@@ -900,17 +899,15 @@ nat_add_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
900 | 899 | ||
901 | GNUNET_CONTAINER_DLL_insert (plugin->ipv4_addr_head, | 900 | GNUNET_CONTAINER_DLL_insert (plugin->ipv4_addr_head, |
902 | plugin->ipv4_addr_tail, w_t4); | 901 | plugin->ipv4_addr_tail, w_t4); |
903 | } | 902 | |
904 | #if DEBUG_HTTP | ||
905 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 903 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
906 | "Notifying transport to add IPv4 address `%s'\n", | 904 | "Notifying transport to add IPv4 address `%s'\n", |
907 | http_plugin_address_to_string (NULL, &w_t4->addr, | 905 | http_plugin_address_to_string (NULL, &w_t4->addr, |
908 | sizeof (struct | 906 | sizeof (struct |
909 | IPv4HttpAddress))); | 907 | IPv4HttpAddress))); |
910 | #endif | ||
911 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t4->addr, | 908 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t4->addr, |
912 | sizeof (struct IPv4HttpAddress)); | 909 | sizeof (struct IPv4HttpAddress)); |
913 | 910 | } | |
914 | break; | 911 | break; |
915 | case AF_INET6: | 912 | case AF_INET6: |
916 | w_t6 = find_address (plugin, addr, addrlen); | 913 | w_t6 = find_address (plugin, addr, addrlen); |
@@ -923,16 +920,15 @@ nat_add_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
923 | 920 | ||
924 | GNUNET_CONTAINER_DLL_insert (plugin->ipv6_addr_head, | 921 | GNUNET_CONTAINER_DLL_insert (plugin->ipv6_addr_head, |
925 | plugin->ipv6_addr_tail, w_t6); | 922 | plugin->ipv6_addr_tail, w_t6); |
926 | } | 923 | |
927 | #if DEBUG_HTTP | 924 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
928 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | ||
929 | "Notifying transport to add IPv6 address `%s'\n", | 925 | "Notifying transport to add IPv6 address `%s'\n", |
930 | http_plugin_address_to_string (NULL, &w_t6->addr6, | 926 | http_plugin_address_to_string (NULL, &w_t6->addr6, |
931 | sizeof (struct | 927 | sizeof (struct |
932 | IPv6HttpAddress))); | 928 | IPv6HttpAddress))); |
933 | #endif | 929 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t6->addr6, |
934 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t6->addr6, | ||
935 | sizeof (struct IPv6HttpAddress)); | 930 | sizeof (struct IPv6HttpAddress)); |
931 | } | ||
936 | break; | 932 | break; |
937 | default: | 933 | default: |
938 | return; | 934 | return; |
@@ -954,15 +950,15 @@ nat_remove_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
954 | { | 950 | { |
955 | case AF_INET: | 951 | case AF_INET: |
956 | w_t4 = find_address (plugin, addr, addrlen); | 952 | w_t4 = find_address (plugin, addr, addrlen); |
953 | if (w_t4 == NULL) | ||
957 | return; | 954 | return; |
958 | 955 | ||
959 | #if DEBUG_HTTP | 956 | |
960 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 957 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
961 | "Notifying transport to remove IPv4 address `%s'\n", | 958 | "Notifying transport to remove IPv4 address `%s'\n", |
962 | http_plugin_address_to_string (NULL, &w_t4->addr, | 959 | http_plugin_address_to_string (NULL, &w_t4->addr, |
963 | sizeof (struct | 960 | sizeof (struct |
964 | IPv4HttpAddress))); | 961 | IPv4HttpAddress))); |
965 | #endif | ||
966 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t4->addr, | 962 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t4->addr, |
967 | sizeof (struct IPv4HttpAddress)); | 963 | sizeof (struct IPv4HttpAddress)); |
968 | 964 | ||
@@ -974,13 +970,13 @@ nat_remove_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
974 | w_t6 = find_address (plugin, addr, addrlen); | 970 | w_t6 = find_address (plugin, addr, addrlen); |
975 | if (w_t6 == NULL) | 971 | if (w_t6 == NULL) |
976 | return; | 972 | return; |
977 | #if DEBUG_HTTP | 973 | |
978 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 974 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
979 | "Notifying transport to remove IPv6 address `%s'\n", | 975 | "Notifying transport to remove IPv6 address `%s'\n", |
980 | http_plugin_address_to_string (NULL, &w_t6->addr6, | 976 | http_plugin_address_to_string (NULL, &w_t6->addr6, |
981 | sizeof (struct | 977 | sizeof (struct |
982 | IPv6HttpAddress))); | 978 | IPv6HttpAddress))); |
983 | #endif | 979 | |
984 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t6->addr6, | 980 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t6->addr6, |
985 | sizeof (struct IPv6HttpAddress)); | 981 | sizeof (struct IPv6HttpAddress)); |
986 | 982 | ||
@@ -1008,15 +1004,13 @@ nat_port_map_callback (void *cls, int add_remove, const struct sockaddr *addr, | |||
1008 | socklen_t addrlen) | 1004 | socklen_t addrlen) |
1009 | { | 1005 | { |
1010 | GNUNET_assert (cls != NULL); | 1006 | GNUNET_assert (cls != NULL); |
1011 | #if DEBUG_HTTP | ||
1012 | struct Plugin *plugin = cls; | 1007 | struct Plugin *plugin = cls; |
1013 | #endif | 1008 | |
1014 | #if DEBUG_HTTP | ||
1015 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1009 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
1016 | "NPMC called %s to address `%s'\n", | 1010 | "NPMC called %s to address `%s'\n", |
1017 | (add_remove == GNUNET_NO) ? "remove" : "add", | 1011 | (add_remove == GNUNET_NO) ? "remove" : "add", |
1018 | GNUNET_a2s (addr, addrlen)); | 1012 | GNUNET_a2s (addr, addrlen)); |
1019 | #endif | 1013 | |
1020 | switch (add_remove) | 1014 | switch (add_remove) |
1021 | { | 1015 | { |
1022 | case GNUNET_YES: | 1016 | case GNUNET_YES: |