diff options
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 5b0a58fac..d6b5ac23f 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -953,7 +953,8 @@ struct GNUNET_TIME_Relative ats_regular_interval; | |||
953 | * disconnected or must we ask all plugins to | 953 | * disconnected or must we ask all plugins to |
954 | * disconnect? | 954 | * disconnect? |
955 | */ | 955 | */ |
956 | static void disconnect_neighbour (struct NeighbourMapEntry *n, int check); | 956 | static void |
957 | disconnect_neighbour (struct NeighbourMapEntry *n, int check); | ||
957 | 958 | ||
958 | /** | 959 | /** |
959 | * Check the ready list for the given neighbour and if a plugin is | 960 | * Check the ready list for the given neighbour and if a plugin is |
@@ -961,10 +962,11 @@ static void disconnect_neighbour (struct NeighbourMapEntry *n, int check); | |||
961 | * | 962 | * |
962 | * @param nexi target peer for which to transmit | 963 | * @param nexi target peer for which to transmit |
963 | */ | 964 | */ |
964 | static void try_transmission_to_peer (struct NeighbourMapEntry *n); | 965 | static void |
966 | try_transmission_to_peer (struct NeighbourMapEntry *n); | ||
965 | 967 | ||
966 | struct ForeignAddressList *get_preferred_ats_address (struct NeighbourMapEntry | 968 | struct ForeignAddressList * |
967 | *n); | 969 | get_preferred_ats_address (struct NeighbourMapEntry *n); |
968 | 970 | ||
969 | /** | 971 | /** |
970 | * Find an entry in the neighbour list for a particular peer. | 972 | * Find an entry in the neighbour list for a particular peer. |
@@ -1223,8 +1225,8 @@ read_blacklist_file (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
1223 | #endif | 1225 | #endif |
1224 | memcpy (&enc, &data[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)); | 1226 | memcpy (&enc, &data[pos], sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)); |
1225 | if (!isspace | 1227 | if (!isspace |
1226 | ((unsigned char) enc. | 1228 | ((unsigned char) |
1227 | encoding[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1])) | 1229 | enc.encoding[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1])) |
1228 | { | 1230 | { |
1229 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1231 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1230 | _ | 1232 | _ |
@@ -1523,7 +1525,8 @@ transmit_send_ok (struct TransportClient *client, struct NeighbourMapEntry *n, | |||
1523 | * | 1525 | * |
1524 | * @param fal address to set to 'connected' | 1526 | * @param fal address to set to 'connected' |
1525 | */ | 1527 | */ |
1526 | static void mark_address_connected (struct ForeignAddressList *fal); | 1528 | static void |
1529 | mark_address_connected (struct ForeignAddressList *fal); | ||
1527 | 1530 | ||
1528 | 1531 | ||
1529 | 1532 | ||
@@ -1939,8 +1942,8 @@ mark_address_connected (struct ForeignAddressList *fal) | |||
1939 | /* Have an inbound connection to this peer which is valid; our id is lower, ignore outbound connection! */ | 1942 | /* Have an inbound connection to this peer which is valid; our id is lower, ignore outbound connection! */ |
1940 | if ((inbound != NULL) && (0 != fal->addrlen) && | 1943 | if ((inbound != NULL) && (0 != fal->addrlen) && |
1941 | (1 == | 1944 | (1 == |
1942 | GNUNET_CRYPTO_hash_xorcmp (&inbound->ready_list->neighbour-> | 1945 | GNUNET_CRYPTO_hash_xorcmp (&inbound->ready_list->neighbour->id. |
1943 | id.hashPubKey, &my_identity.hashPubKey, | 1946 | hashPubKey, &my_identity.hashPubKey, |
1944 | &null_hash))) | 1947 | &null_hash))) |
1945 | { | 1948 | { |
1946 | #if DEBUG_INBOUND | 1949 | #if DEBUG_INBOUND |
@@ -1951,8 +1954,8 @@ mark_address_connected (struct ForeignAddressList *fal) | |||
1951 | } | 1954 | } |
1952 | else if ((outbound != NULL) && (0 == fal->addrlen) && | 1955 | else if ((outbound != NULL) && (0 == fal->addrlen) && |
1953 | ((-1 == | 1956 | ((-1 == |
1954 | GNUNET_CRYPTO_hash_xorcmp (&outbound->ready_list->neighbour->id. | 1957 | GNUNET_CRYPTO_hash_xorcmp (&outbound->ready_list->neighbour-> |
1955 | hashPubKey, &my_identity.hashPubKey, | 1958 | id.hashPubKey, &my_identity.hashPubKey, |
1956 | &null_hash)))) | 1959 | &null_hash)))) |
1957 | { | 1960 | { |
1958 | #if DEBUG_INBOUND | 1961 | #if DEBUG_INBOUND |
@@ -2056,10 +2059,10 @@ find_ready_address (struct NeighbourMapEntry *neighbour) | |||
2056 | if (((best_address == NULL) || (addresses->connected == GNUNET_YES) || | 2059 | if (((best_address == NULL) || (addresses->connected == GNUNET_YES) || |
2057 | (best_address->connected == GNUNET_NO)) && | 2060 | (best_address->connected == GNUNET_NO)) && |
2058 | (addresses->in_transmit == GNUNET_NO) && ((best_address == NULL) || | 2061 | (addresses->in_transmit == GNUNET_NO) && ((best_address == NULL) || |
2059 | (addresses->latency. | 2062 | (addresses-> |
2060 | rel_value < | 2063 | latency.rel_value < |
2061 | best_address->latency. | 2064 | best_address-> |
2062 | rel_value))) | 2065 | latency.rel_value))) |
2063 | best_address = addresses; | 2066 | best_address = addresses; |
2064 | /* FIXME: also give lower-latency addresses that are not | 2067 | /* FIXME: also give lower-latency addresses that are not |
2065 | * connected a chance some times... */ | 2068 | * connected a chance some times... */ |
@@ -2960,7 +2963,8 @@ neighbour_timeout_task (void *cls, | |||
2960 | * | 2963 | * |
2961 | * @param fal address to PING | 2964 | * @param fal address to PING |
2962 | */ | 2965 | */ |
2963 | static void schedule_next_ping (struct ForeignAddressList *fal); | 2966 | static void |
2967 | schedule_next_ping (struct ForeignAddressList *fal); | ||
2964 | 2968 | ||
2965 | 2969 | ||
2966 | /** | 2970 | /** |
@@ -3295,8 +3299,8 @@ static struct BlacklistCheck *bc_tail; | |||
3295 | * @param cls the 'struct BlacklistCheck*' | 3299 | * @param cls the 'struct BlacklistCheck*' |
3296 | * @param tc unused | 3300 | * @param tc unused |
3297 | */ | 3301 | */ |
3298 | static void do_blacklist_check (void *cls, | 3302 | static void |
3299 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 3303 | do_blacklist_check (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); |
3300 | 3304 | ||
3301 | /** | 3305 | /** |
3302 | * Transmit blacklist query to the client. | 3306 | * Transmit blacklist query to the client. |
@@ -3633,9 +3637,8 @@ send_periodic_ping (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
3633 | "Some validation of address `%s' via `%s' for peer `%4s' already in progress.\n", | 3637 | "Some validation of address `%s' via `%s' for peer `%4s' already in progress.\n", |
3634 | (peer_address->addr != NULL) ? a2s (tp->short_name, | 3638 | (peer_address->addr != NULL) ? a2s (tp->short_name, |
3635 | peer_address->addr, | 3639 | peer_address->addr, |
3636 | peer_address-> | 3640 | peer_address->addrlen) : |
3637 | addrlen) : "<inbound>", | 3641 | "<inbound>", tp->short_name, GNUNET_i2s (&neighbour->id)); |
3638 | tp->short_name, GNUNET_i2s (&neighbour->id)); | ||
3639 | #endif | 3642 | #endif |
3640 | schedule_next_ping (peer_address); | 3643 | schedule_next_ping (peer_address); |
3641 | return; | 3644 | return; |
@@ -4065,8 +4068,9 @@ check_pending_validation (void *cls, const GNUNET_HashCode * key, void *value) | |||
4065 | GNUNET_NO); | 4068 | GNUNET_NO); |
4066 | fal->latency = GNUNET_TIME_absolute_get_duration (ve->send_time); | 4069 | fal->latency = GNUNET_TIME_absolute_get_duration (ve->send_time); |
4067 | update_addr_value (fal, | 4070 | update_addr_value (fal, |
4068 | GNUNET_TIME_absolute_get_duration (ve->send_time). | 4071 | GNUNET_TIME_absolute_get_duration (ve-> |
4069 | rel_value, GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY); | 4072 | send_time).rel_value, |
4073 | GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY); | ||
4070 | 4074 | ||
4071 | schedule_next_ping (fal); | 4075 | schedule_next_ping (fal); |
4072 | if (n->latency.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) | 4076 | if (n->latency.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) |
@@ -4571,8 +4575,8 @@ process_hello (struct TransportPlugin *plugin, | |||
4571 | chvc = chvc_head; | 4575 | chvc = chvc_head; |
4572 | while (NULL != chvc) | 4576 | while (NULL != chvc) |
4573 | { | 4577 | { |
4574 | if (GNUNET_HELLO_equals (hello, chvc->hello, GNUNET_TIME_absolute_get ()). | 4578 | if (GNUNET_HELLO_equals |
4575 | abs_value > 0) | 4579 | (hello, chvc->hello, GNUNET_TIME_absolute_get ()).abs_value > 0) |
4576 | { | 4580 | { |
4577 | #if DEBUG_TRANSPORT_HELLO > 2 | 4581 | #if DEBUG_TRANSPORT_HELLO > 2 |
4578 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 4582 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -4889,8 +4893,9 @@ handle_ping (void *cls, const struct GNUNET_MessageHeader *message, | |||
4889 | memcpy (&pong[1], plugin->short_name, slen); | 4893 | memcpy (&pong[1], plugin->short_name, slen); |
4890 | if ((sender_address != NULL) && (sender_address_len > 0)) | 4894 | if ((sender_address != NULL) && (sender_address_len > 0)) |
4891 | memcpy (&((char *) &pong[1])[slen], sender_address, sender_address_len); | 4895 | memcpy (&((char *) &pong[1])[slen], sender_address, sender_address_len); |
4892 | if (GNUNET_TIME_absolute_get_remaining (session_header->pong_sig_expires). | 4896 | if (GNUNET_TIME_absolute_get_remaining |
4893 | rel_value < PONG_SIGNATURE_LIFETIME.rel_value / 4) | 4897 | (session_header->pong_sig_expires).rel_value < |
4898 | PONG_SIGNATURE_LIFETIME.rel_value / 4) | ||
4894 | { | 4899 | { |
4895 | /* create / update cached sig */ | 4900 | /* create / update cached sig */ |
4896 | #if DEBUG_TRANSPORT | 4901 | #if DEBUG_TRANSPORT |
@@ -5235,8 +5240,8 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
5235 | #if DEBUG_TRANSPORT | 5240 | #if DEBUG_TRANSPORT |
5236 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 5241 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
5237 | "Throttling read (%llu bytes excess at %u b/s), waiting %llu ms before reading more.\n", | 5242 | "Throttling read (%llu bytes excess at %u b/s), waiting %llu ms before reading more.\n", |
5238 | (unsigned long long) n->in_tracker. | 5243 | (unsigned long long) n-> |
5239 | consumption_since_last_update__, | 5244 | in_tracker.consumption_since_last_update__, |
5240 | (unsigned int) n->in_tracker.available_bytes_per_s__, | 5245 | (unsigned int) n->in_tracker.available_bytes_per_s__, |
5241 | (unsigned long long) ret.rel_value); | 5246 | (unsigned long long) ret.rel_value); |
5242 | #endif | 5247 | #endif |