diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-09-01 13:18:50 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-09-01 13:18:50 +0000 |
commit | c34548d2d6629269e689a9b2685df7e375a9c7a8 (patch) | |
tree | c5006973126c1ab4c8ca2a826a0c73c5751f3c38 /src | |
parent | ca3b021998040082862725efd5c310a65fae6b92 (diff) | |
download | gnunet-c34548d2d6629269e689a9b2685df7e375a9c7a8.tar.gz gnunet-c34548d2d6629269e689a9b2685df7e375a9c7a8.zip |
transport service hello reduction, klocwork fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 24 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 1 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 4 |
3 files changed, 24 insertions, 5 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index de25666fa..9c873291f 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -2792,6 +2792,11 @@ setup_new_neighbour (const struct GNUNET_PeerIdentity *peer, | |||
2792 | n->piter = GNUNET_PEERINFO_iterate (peerinfo, peer, | 2792 | n->piter = GNUNET_PEERINFO_iterate (peerinfo, peer, |
2793 | GNUNET_TIME_UNIT_FOREVER_REL, | 2793 | GNUNET_TIME_UNIT_FOREVER_REL, |
2794 | &add_hello_for_peer, n); | 2794 | &add_hello_for_peer, n); |
2795 | |||
2796 | GNUNET_STATISTICS_update (stats, | ||
2797 | gettext_noop ("# HELLO's sent to new neighbors"), | ||
2798 | 1, | ||
2799 | GNUNET_NO); | ||
2795 | transmit_to_peer (NULL, NULL, 0, | 2800 | transmit_to_peer (NULL, NULL, 0, |
2796 | HELLO_ADDRESS_EXPIRATION, | 2801 | HELLO_ADDRESS_EXPIRATION, |
2797 | (const char *) our_hello, GNUNET_HELLO_size(our_hello), | 2802 | (const char *) our_hello, GNUNET_HELLO_size(our_hello), |
@@ -3258,8 +3263,14 @@ send_periodic_ping (void *cls, | |||
3258 | &neighbour->id.hashPubKey, | 3263 | &neighbour->id.hashPubKey, |
3259 | va, | 3264 | va, |
3260 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 3265 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
3261 | hello_size = GNUNET_HELLO_size(our_hello); | 3266 | |
3267 | if (peer_address->validated != GNUNET_YES) | ||
3268 | hello_size = GNUNET_HELLO_size(our_hello); | ||
3269 | else | ||
3270 | hello_size = 0; | ||
3271 | |||
3262 | tsize = sizeof(struct TransportPingMessage) + hello_size; | 3272 | tsize = sizeof(struct TransportPingMessage) + hello_size; |
3273 | |||
3263 | if (peer_address->addr != NULL) | 3274 | if (peer_address->addr != NULL) |
3264 | { | 3275 | { |
3265 | slen = strlen (tp->short_name) + 1; | 3276 | slen = strlen (tp->short_name) + 1; |
@@ -3273,7 +3284,9 @@ send_periodic_ping (void *cls, | |||
3273 | ping.header.type = htons(GNUNET_MESSAGE_TYPE_TRANSPORT_PING); | 3284 | ping.header.type = htons(GNUNET_MESSAGE_TYPE_TRANSPORT_PING); |
3274 | ping.challenge = htonl(va->challenge); | 3285 | ping.challenge = htonl(va->challenge); |
3275 | memcpy(&ping.target, &neighbour->id, sizeof(struct GNUNET_PeerIdentity)); | 3286 | memcpy(&ping.target, &neighbour->id, sizeof(struct GNUNET_PeerIdentity)); |
3276 | memcpy(message_buf, our_hello, hello_size); | 3287 | if (peer_address->validated != GNUNET_YES) |
3288 | memcpy(message_buf, our_hello, hello_size); | ||
3289 | |||
3277 | if (peer_address->addr != NULL) | 3290 | if (peer_address->addr != NULL) |
3278 | { | 3291 | { |
3279 | ping.header.size = htons(sizeof(struct TransportPingMessage) + | 3292 | ping.header.size = htons(sizeof(struct TransportPingMessage) + |
@@ -3307,6 +3320,13 @@ send_periodic_ping (void *cls, | |||
3307 | "HELLO", hello_size, | 3320 | "HELLO", hello_size, |
3308 | "PING"); | 3321 | "PING"); |
3309 | #endif | 3322 | #endif |
3323 | if (peer_address->validated != GNUNET_YES) | ||
3324 | GNUNET_STATISTICS_update (stats, | ||
3325 | gettext_noop ("# PING+HELLO messages sent"), | ||
3326 | 1, | ||
3327 | GNUNET_NO); | ||
3328 | |||
3329 | |||
3310 | GNUNET_STATISTICS_update (stats, | 3330 | GNUNET_STATISTICS_update (stats, |
3311 | gettext_noop ("# PING messages sent for re-validation"), | 3331 | gettext_noop ("# PING messages sent for re-validation"), |
3312 | 1, | 3332 | 1, |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index d382b5108..ffc738f53 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -2043,7 +2043,6 @@ tcp_plugin_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
2043 | return; | 2043 | return; |
2044 | } | 2044 | } |
2045 | 2045 | ||
2046 | port = 0; | ||
2047 | port_start = NULL; | 2046 | port_start = NULL; |
2048 | for (i = 0; i < sizeof(mybuf); i++) | 2047 | for (i = 0; i < sizeof(mybuf); i++) |
2049 | { | 2048 | { |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index f8c68244a..02f81a576 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -978,7 +978,8 @@ process_interfaces (void *cls, | |||
978 | &((struct sockaddr_in6 *) addr)->sin6_addr, | 978 | &((struct sockaddr_in6 *) addr)->sin6_addr, |
979 | sizeof (struct in6_addr)); | 979 | sizeof (struct in6_addr)); |
980 | GNUNET_assert(NULL != inet_ntop(AF_INET6, &t6.ipv6_addr, &buf[0], INET6_ADDRSTRLEN)); | 980 | GNUNET_assert(NULL != inet_ntop(AF_INET6, &t6.ipv6_addr, &buf[0], INET6_ADDRSTRLEN)); |
981 | if ((plugin->bind_address != NULL) || ((plugin->bind6_address != NULL) && (0 != strcmp(buf, plugin->bind_address)))) | 981 | if (((plugin->bind_address != NULL) && (0 != strcmp(buf, plugin->bind_address))) |
982 | || ((plugin->bind6_address != NULL) && (0 != strcmp(buf, plugin->bind6_address)))) | ||
982 | { | 983 | { |
983 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Not notifying transport of address %s\n", "UDP", GNUNET_a2s (addr, addrlen)); | 984 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Not notifying transport of address %s\n", "UDP", GNUNET_a2s (addr, addrlen)); |
984 | return GNUNET_OK; | 985 | return GNUNET_OK; |
@@ -1177,7 +1178,6 @@ udp_plugin_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
1177 | return; | 1178 | return; |
1178 | } | 1179 | } |
1179 | 1180 | ||
1180 | port = 0; | ||
1181 | port_start = NULL; | 1181 | port_start = NULL; |
1182 | for (i = 0; i < sizeof(mybuf); i++) | 1182 | for (i = 0; i < sizeof(mybuf); i++) |
1183 | { | 1183 | { |