diff options
-rw-r--r-- | src/transport/gnunet-service-transport.c | 6 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 22 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 46 |
3 files changed, 34 insertions, 40 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 6a3c2a17c..50faeae89 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -150,15 +150,12 @@ process_payload (const struct GNUNET_PeerIdentity *peer, | |||
150 | 150 | ||
151 | do_forward = GNUNET_SYSERR; | 151 | do_forward = GNUNET_SYSERR; |
152 | ret = GST_neighbours_calculate_receive_delay (peer, msg_size, &do_forward); | 152 | ret = GST_neighbours_calculate_receive_delay (peer, msg_size, &do_forward); |
153 | |||
154 | if (! GST_neighbours_test_connected (peer)) | 153 | if (! GST_neighbours_test_connected (peer)) |
155 | { | 154 | { |
156 | |||
157 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 155 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
158 | "Discarded %u bytes type %u payload from peer `%s'\n", | 156 | "Discarded %u bytes type %u payload from peer `%s'\n", |
159 | msg_size, | 157 | msg_size, |
160 | ntohs (message->type), GNUNET_i2s (peer)); | 158 | ntohs (message->type), GNUNET_i2s (peer)); |
161 | |||
162 | GNUNET_STATISTICS_update (GST_stats, | 159 | GNUNET_STATISTICS_update (GST_stats, |
163 | gettext_noop | 160 | gettext_noop |
164 | ("# bytes payload discarded due to not connected peer"), | 161 | ("# bytes payload discarded due to not connected peer"), |
@@ -175,9 +172,7 @@ process_payload (const struct GNUNET_PeerIdentity *peer, | |||
175 | im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); | 172 | im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV); |
176 | im->peer = *peer; | 173 | im->peer = *peer; |
177 | memcpy (&im[1], message, ntohs (message->size)); | 174 | memcpy (&im[1], message, ntohs (message->size)); |
178 | |||
179 | GST_clients_broadcast (&im->header, GNUNET_YES); | 175 | GST_clients_broadcast (&im->header, GNUNET_YES); |
180 | |||
181 | return ret; | 176 | return ret; |
182 | } | 177 | } |
183 | 178 | ||
@@ -654,7 +649,6 @@ neighbours_connect_notification (void *cls, | |||
654 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 649 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
655 | "We are now connected to peer `%s' and %u peers in total\n", | 650 | "We are now connected to peer `%s' and %u peers in total\n", |
656 | GNUNET_i2s (peer), connections); | 651 | GNUNET_i2s (peer), connections); |
657 | |||
658 | connect_msg->header.size = htons (sizeof (buf)); | 652 | connect_msg->header.size = htons (sizeof (buf)); |
659 | connect_msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); | 653 | connect_msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); |
660 | connect_msg->id = *peer; | 654 | connect_msg->id = *peer; |
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index c3ef42652..0aeb661d4 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2010,2011 Christian Grothoff (and other contributing authors) | 3 | (C) 2010-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -381,9 +381,10 @@ unicast (struct TransportClient *tc, | |||
381 | if ((tc->message_count >= MAX_PENDING) && (GNUNET_YES == may_drop)) | 381 | if ((tc->message_count >= MAX_PENDING) && (GNUNET_YES == may_drop)) |
382 | { | 382 | { |
383 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 383 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
384 | _ | 384 | _("Dropping message of type %u and size %u, have %u/%u messages pending\n"), |
385 | ("Dropping message of type %u and size %u, have %u/%u messages pending\n"), | 385 | ntohs (msg->type), |
386 | ntohs (msg->type), ntohs (msg->size), tc->message_count, | 386 | ntohs (msg->size), |
387 | tc->message_count, | ||
387 | MAX_PENDING); | 388 | MAX_PENDING); |
388 | GNUNET_STATISTICS_update (GST_stats, | 389 | GNUNET_STATISTICS_update (GST_stats, |
389 | gettext_noop | 390 | gettext_noop |
@@ -459,7 +460,7 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client) | |||
459 | * Function called for each of our connected neighbours. Notify the | 460 | * Function called for each of our connected neighbours. Notify the |
460 | * client about the existing neighbour. | 461 | * client about the existing neighbour. |
461 | * | 462 | * |
462 | * @param cls the 'struct TransportClient' to notify | 463 | * @param cls the `struct TransportClient *` to notify |
463 | * @param peer identity of the neighbour | 464 | * @param peer identity of the neighbour |
464 | * @param address the address | 465 | * @param address the address |
465 | * @param bandwidth_in inbound bandwidth in NBO | 466 | * @param bandwidth_in inbound bandwidth in NBO |
@@ -702,9 +703,9 @@ try_connect_if_allowed (void *cls, | |||
702 | { | 703 | { |
703 | if (GNUNET_OK != result) | 704 | if (GNUNET_OK != result) |
704 | { | 705 | { |
705 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 706 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
706 | "Blacklist refuses connection attempt to peer `%s'\n", | 707 | "Blacklist refuses connection attempt to peer `%s'\n", |
707 | GNUNET_i2s (peer)); | 708 | GNUNET_i2s (peer)); |
708 | return; /* not allowed */ | 709 | return; /* not allowed */ |
709 | } | 710 | } |
710 | GST_neighbours_try_connect (peer); | 711 | GST_neighbours_try_connect (peer); |
@@ -733,7 +734,7 @@ clients_handle_request_connect (void *cls, struct GNUNET_SERVER_Client *client, | |||
733 | if (0 == memcmp (&trcm->peer, &GST_my_identity, | 734 | if (0 == memcmp (&trcm->peer, &GST_my_identity, |
734 | sizeof (struct GNUNET_PeerIdentity))) | 735 | sizeof (struct GNUNET_PeerIdentity))) |
735 | { | 736 | { |
736 | GNUNET_break_op (0); | 737 | GNUNET_break_op (0); |
737 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 738 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
738 | "Received a request connect message myself `%s'\n", | 739 | "Received a request connect message myself `%s'\n", |
739 | GNUNET_i2s (&trcm->peer)); | 740 | GNUNET_i2s (&trcm->peer)); |
@@ -816,8 +817,7 @@ clients_handle_address_to_string (void *cls, | |||
816 | } | 817 | } |
817 | address = (const char *) &alum[1]; | 818 | address = (const char *) &alum[1]; |
818 | plugin_name = (const char *) &address[address_len]; | 819 | plugin_name = (const char *) &address[address_len]; |
819 | if (plugin_name[size - sizeof (struct AddressLookupMessage) - address_len - 1] | 820 | if ('\0' != plugin_name[size - sizeof (struct AddressLookupMessage) - address_len - 1]) |
820 | != '\0') | ||
821 | { | 821 | { |
822 | GNUNET_break (0); | 822 | GNUNET_break (0); |
823 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 823 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index c7d43ca56..d088c05ef 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -2457,7 +2457,7 @@ send_utilization_data (void *cls, | |||
2457 | */ | 2457 | */ |
2458 | static void | 2458 | static void |
2459 | utilization_transmission (void *cls, | 2459 | utilization_transmission (void *cls, |
2460 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 2460 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
2461 | { | 2461 | { |
2462 | util_transmission_tk = GNUNET_SCHEDULER_NO_TASK; | 2462 | util_transmission_tk = GNUNET_SCHEDULER_NO_TASK; |
2463 | 2463 | ||
@@ -3234,37 +3234,37 @@ struct IteratorContext | |||
3234 | /** | 3234 | /** |
3235 | * Call the callback from the closure for each connected neighbour. | 3235 | * Call the callback from the closure for each connected neighbour. |
3236 | * | 3236 | * |
3237 | * @param cls the 'struct IteratorContext' | 3237 | * @param cls the `struct IteratorContext` |
3238 | * @param key the hash of the public key of the neighbour | 3238 | * @param key the hash of the public key of the neighbour |
3239 | * @param value the 'struct NeighbourMapEntry' | 3239 | * @param value the `struct NeighbourMapEntry` |
3240 | * @return GNUNET_OK (continue to iterate) | 3240 | * @return #GNUNET_OK (continue to iterate) |
3241 | */ | 3241 | */ |
3242 | static int | 3242 | static int |
3243 | neighbours_iterate (void *cls, const struct GNUNET_PeerIdentity * key, void *value) | 3243 | neighbours_iterate (void *cls, |
3244 | const struct GNUNET_PeerIdentity *key, | ||
3245 | void *value) | ||
3244 | { | 3246 | { |
3245 | struct IteratorContext *ic = cls; | 3247 | struct IteratorContext *ic = cls; |
3246 | struct NeighbourMapEntry *n = value; | 3248 | struct NeighbourMapEntry *n = value; |
3249 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in; | ||
3250 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out; | ||
3247 | 3251 | ||
3248 | if (GNUNET_YES == test_connected (n)) | 3252 | if (GNUNET_YES != test_connected (n)) |
3249 | { | 3253 | return GNUNET_OK; |
3250 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in; | ||
3251 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out; | ||
3252 | |||
3253 | if (NULL != n->primary_address.address) | ||
3254 | { | ||
3255 | bandwidth_in = n->primary_address.bandwidth_in; | ||
3256 | bandwidth_out = n->primary_address.bandwidth_out; | ||
3257 | } | ||
3258 | else | ||
3259 | { | ||
3260 | bandwidth_in = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; | ||
3261 | bandwidth_out = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; | ||
3262 | } | ||
3263 | 3254 | ||
3264 | ic->cb (ic->cb_cls, &n->id, | 3255 | if (NULL != n->primary_address.address) |
3265 | n->primary_address.address, | 3256 | { |
3266 | bandwidth_in, bandwidth_out); | 3257 | bandwidth_in = n->primary_address.bandwidth_in; |
3258 | bandwidth_out = n->primary_address.bandwidth_out; | ||
3259 | } | ||
3260 | else | ||
3261 | { | ||
3262 | bandwidth_in = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; | ||
3263 | bandwidth_out = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; | ||
3267 | } | 3264 | } |
3265 | ic->cb (ic->cb_cls, &n->id, | ||
3266 | n->primary_address.address, | ||
3267 | bandwidth_in, bandwidth_out); | ||
3268 | return GNUNET_OK; | 3268 | return GNUNET_OK; |
3269 | } | 3269 | } |
3270 | 3270 | ||