diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-18 17:31:14 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-18 17:31:14 +0000 |
commit | bb720291e7a5a71e9139865f97025bfa179cd3a3 (patch) | |
tree | 09d1184ae8155aa7906a6823e4b9b432a4bfb7ec | |
parent | c5f60b28bfafd0b8196eb110e7cb3a8a1b12aa0f (diff) | |
download | gnunet-bb720291e7a5a71e9139865f97025bfa179cd3a3.tar.gz gnunet-bb720291e7a5a71e9139865f97025bfa179cd3a3.zip |
-remarking on things to fix
-rw-r--r-- | src/transport/gnunet-service-transport.c | 31 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 14 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 12 |
3 files changed, 38 insertions, 19 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 330382604..01ca2fc67 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -188,6 +188,7 @@ process_hello_update (void *cls, const struct GNUNET_MessageHeader *hello) | |||
188 | GST_neighbours_iterate (&transmit_our_hello, (void *) hello); | 188 | GST_neighbours_iterate (&transmit_our_hello, (void *) hello); |
189 | } | 189 | } |
190 | 190 | ||
191 | |||
191 | /** | 192 | /** |
192 | * We received some payload. Prepare to pass it on to our clients. | 193 | * We received some payload. Prepare to pass it on to our clients. |
193 | * | 194 | * |
@@ -211,7 +212,7 @@ process_payload (const struct GNUNET_PeerIdentity *peer, | |||
211 | 212 | ||
212 | do_forward = GNUNET_SYSERR; | 213 | do_forward = GNUNET_SYSERR; |
213 | ret = GST_neighbours_calculate_receive_delay (peer, msg_size, &do_forward); | 214 | ret = GST_neighbours_calculate_receive_delay (peer, msg_size, &do_forward); |
214 | if (!GST_neighbours_test_connected (peer)) | 215 | if (! GST_neighbours_test_connected (peer)) |
215 | { | 216 | { |
216 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 217 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
217 | "Discarded %u bytes type %u payload from peer `%s'\n", msg_size, | 218 | "Discarded %u bytes type %u payload from peer `%s'\n", msg_size, |
@@ -222,6 +223,7 @@ process_payload (const struct GNUNET_PeerIdentity *peer, | |||
222 | return ret; | 223 | return ret; |
223 | } | 224 | } |
224 | 225 | ||
226 | // FIXME: why is this call here? | ||
225 | GST_ats_add_address (address, session, NULL, 0); | 227 | GST_ats_add_address (address, session, NULL, 0); |
226 | 228 | ||
227 | if (GNUNET_YES != do_forward) | 229 | if (GNUNET_YES != do_forward) |
@@ -357,6 +359,7 @@ connect_bl_check_cont (void *cls, | |||
357 | GNUNET_free (blctx); | 359 | GNUNET_free (blctx); |
358 | } | 360 | } |
359 | 361 | ||
362 | |||
360 | /** | 363 | /** |
361 | * Black list check result for try_connect call | 364 | * Black list check result for try_connect call |
362 | * If connection to the peer is allowed request adddress and | 365 | * If connection to the peer is allowed request adddress and |
@@ -377,7 +380,9 @@ connect_transport_bl_check_cont (void *cls, | |||
377 | if (GNUNET_OK == result) | 380 | if (GNUNET_OK == result) |
378 | { | 381 | { |
379 | /* Blacklist allows to speak to this transport */ | 382 | /* Blacklist allows to speak to this transport */ |
380 | GST_ats_add_address(blctx->address, blctx->session, blctx->ats, blctx->ats_count); | 383 | GST_ats_add_address (blctx->address, |
384 | blctx->session, | ||
385 | blctx->ats, blctx->ats_count); | ||
381 | } | 386 | } |
382 | 387 | ||
383 | if (NULL != blctx->address) | 388 | if (NULL != blctx->address) |
@@ -671,8 +676,9 @@ plugin_env_address_to_type (void *cls, | |||
671 | */ | 676 | */ |
672 | void | 677 | void |
673 | GST_ats_add_address (const struct GNUNET_HELLO_Address *address, | 678 | GST_ats_add_address (const struct GNUNET_HELLO_Address *address, |
674 | struct Session *session, const struct GNUNET_ATS_Information *ats, | 679 | struct Session *session, |
675 | uint32_t ats_count) | 680 | const struct GNUNET_ATS_Information *ats, |
681 | uint32_t ats_count) | ||
676 | { | 682 | { |
677 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | 683 | struct GNUNET_TRANSPORT_PluginFunctions *papi; |
678 | struct GNUNET_ATS_Information ats2[ats_count + 1]; | 684 | struct GNUNET_ATS_Information ats2[ats_count + 1]; |
@@ -710,14 +716,19 @@ GST_ats_add_address (const struct GNUNET_HELLO_Address *address, | |||
710 | ats2[0].type = htonl (GNUNET_ATS_NETWORK_TYPE); | 716 | ats2[0].type = htonl (GNUNET_ATS_NETWORK_TYPE); |
711 | ats2[0].value = htonl (net); | 717 | ats2[0].value = htonl (net); |
712 | memcpy (&ats2[1], ats, sizeof(struct GNUNET_ATS_Information) * ats_count); | 718 | memcpy (&ats2[1], ats, sizeof(struct GNUNET_ATS_Information) * ats_count); |
713 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 719 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
714 | "Notifying ATS about peer `%s''s new address `%s' session %p in network %s\n", | 720 | "Notifying ATS about peer `%s''s new address `%s' session %p in network %s\n", |
715 | GNUNET_i2s (&address->peer), | 721 | GNUNET_i2s (&address->peer), |
716 | (0 == address->address_length) ? "<inbound>" : GST_plugins_a2s (address), | 722 | (0 == address->address_length) |
717 | session, GNUNET_ATS_print_network_type (net)); | 723 | ? "<inbound>" |
718 | GNUNET_ATS_address_add (GST_ats, address, session, ats2, ats_count + 1); | 724 | : GST_plugins_a2s (address), |
725 | session, | ||
726 | GNUNET_ATS_print_network_type (net)); | ||
727 | GNUNET_ATS_address_add (GST_ats, address, session, | ||
728 | ats2, ats_count + 1); | ||
719 | } | 729 | } |
720 | 730 | ||
731 | |||
721 | /** | 732 | /** |
722 | * Notify ATS about property changes to an address | 733 | * Notify ATS about property changes to an address |
723 | * | 734 | * |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 748d88f1f..1bf1fd754 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -3161,6 +3161,8 @@ GST_neighbours_handle_session_syn_ack (const struct GNUNET_MessageHeader *messag | |||
3161 | n->primary_address.bandwidth_in, | 3161 | n->primary_address.bandwidth_in, |
3162 | n->primary_address.bandwidth_out); | 3162 | n->primary_address.bandwidth_out); |
3163 | /* Tell ATS that the outbound session we created to send SYN was successful */ | 3163 | /* Tell ATS that the outbound session we created to send SYN was successful */ |
3164 | // FIXME: shouldn't ATS already know about *outbound* sessions | ||
3165 | // in particular? | ||
3164 | GST_ats_add_address (n->primary_address.address, | 3166 | GST_ats_add_address (n->primary_address.address, |
3165 | n->primary_address.session, | 3167 | n->primary_address.session, |
3166 | NULL, 0); | 3168 | NULL, 0); |
@@ -3204,6 +3206,7 @@ GST_neighbours_handle_session_syn_ack (const struct GNUNET_MessageHeader *messag | |||
3204 | GNUNET_break (GNUNET_NO == n->alternative_address.ats_active); | 3206 | GNUNET_break (GNUNET_NO == n->alternative_address.ats_active); |
3205 | 3207 | ||
3206 | /* Notify about session... perhaps we obtained it */ | 3208 | /* Notify about session... perhaps we obtained it */ |
3209 | // FIXME: why is this needed? | ||
3207 | GST_ats_add_address (n->alternative_address.address, | 3210 | GST_ats_add_address (n->alternative_address.address, |
3208 | n->alternative_address.session, NULL, 0); | 3211 | n->alternative_address.session, NULL, 0); |
3209 | /* Set primary addresses */ | 3212 | /* Set primary addresses */ |
@@ -3444,8 +3447,8 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, | |||
3444 | now wait for the ACK to finally be connected | 3447 | now wait for the ACK to finally be connected |
3445 | - If we sent a SYN_ACK to this peer before */ | 3448 | - If we sent a SYN_ACK to this peer before */ |
3446 | 3449 | ||
3447 | if ( (GNUNET_TRANSPORT_PS_SYN_RECV_ACK != n->state) && | 3450 | if ( (GNUNET_TRANSPORT_PS_SYN_RECV_ACK != n->state) && |
3448 | (ACK_SEND_ACK != n->ack_state)) | 3451 | (ACK_SEND_ACK != n->ack_state)) |
3449 | { | 3452 | { |
3450 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 3453 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
3451 | "Received unexpected ACK message from peer `%s' in state %s/%s\n", | 3454 | "Received unexpected ACK message from peer `%s' in state %s/%s\n", |
@@ -3486,8 +3489,10 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, | |||
3486 | 3489 | ||
3487 | /* Add session to ATS since no session was given (NULL) and we may have | 3490 | /* Add session to ATS since no session was given (NULL) and we may have |
3488 | * obtained a new session */ | 3491 | * obtained a new session */ |
3489 | GST_ats_add_address (n->primary_address.address, n->primary_address.session, | 3492 | // FIXME: likely not the best place to do this... |
3490 | NULL, 0); | 3493 | GST_ats_add_address (n->primary_address.address, |
3494 | n->primary_address.session, | ||
3495 | NULL, 0); | ||
3491 | 3496 | ||
3492 | /* Set primary address to used */ | 3497 | /* Set primary address to used */ |
3493 | set_primary_address (n, | 3498 | set_primary_address (n, |
@@ -3512,6 +3517,7 @@ GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target) | |||
3512 | return test_connected (lookup_neighbour (target)); | 3517 | return test_connected (lookup_neighbour (target)); |
3513 | } | 3518 | } |
3514 | 3519 | ||
3520 | |||
3515 | /** | 3521 | /** |
3516 | * Change the incoming quota for the given peer. | 3522 | * Change the incoming quota for the given peer. |
3517 | * | 3523 | * |
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index e7ede0b07..b02c90009 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -833,13 +833,13 @@ add_valid_address (void *cls, | |||
833 | } | 833 | } |
834 | 834 | ||
835 | ve = find_validation_entry (&public_key, address); | 835 | ve = find_validation_entry (&public_key, address); |
836 | ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration); | 836 | ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, |
837 | 837 | expiration); | |
838 | if (NULL == ve->revalidation_task) | 838 | if (NULL == ve->revalidation_task) |
839 | { | 839 | { |
840 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 840 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
841 | "Starting revalidations for valid address `%s'\n", | 841 | "Starting revalidations for valid address `%s'\n", |
842 | GST_plugins_a2s (ve->address)); | 842 | GST_plugins_a2s (ve->address)); |
843 | ve->next_validation = GNUNET_TIME_absolute_get(); | 843 | ve->next_validation = GNUNET_TIME_absolute_get(); |
844 | ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address, ve); | 844 | ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address, ve); |
845 | } | 845 | } |
@@ -1417,8 +1417,9 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1417 | GNUNET_break_op (0); | 1417 | GNUNET_break_op (0); |
1418 | return GNUNET_SYSERR; | 1418 | return GNUNET_SYSERR; |
1419 | } | 1419 | } |
1420 | if (GNUNET_TIME_absolute_get_remaining | 1420 | if (0 == |
1421 | (GNUNET_TIME_absolute_ntoh (pong->expiration)).rel_value_us == 0) | 1421 | GNUNET_TIME_absolute_get_remaining |
1422 | (GNUNET_TIME_absolute_ntoh (pong->expiration)).rel_value_us) | ||
1422 | { | 1423 | { |
1423 | GNUNET_STATISTICS_update (GST_stats, | 1424 | GNUNET_STATISTICS_update (GST_stats, |
1424 | gettext_noop | 1425 | gettext_noop |
@@ -1490,6 +1491,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1490 | ats[0].value = htonl ((uint32_t) ve->latency.rel_value_us); | 1491 | ats[0].value = htonl ((uint32_t) ve->latency.rel_value_us); |
1491 | ats[1].type = htonl (GNUNET_ATS_NETWORK_TYPE); | 1492 | ats[1].type = htonl (GNUNET_ATS_NETWORK_TYPE); |
1492 | ats[1].value = htonl ((uint32_t) ve->network); | 1493 | ats[1].value = htonl ((uint32_t) ve->network); |
1494 | // FIXME: add vs. update! | ||
1493 | GNUNET_ATS_address_add (GST_ats, ve->address, NULL, ats, 2); | 1495 | GNUNET_ATS_address_add (GST_ats, ve->address, NULL, ats, 2); |
1494 | } | 1496 | } |
1495 | if (validations_running > 0) | 1497 | if (validations_running > 0) |