diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-03-26 14:59:36 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-03-26 14:59:36 +0000 |
commit | adbb8b5d9635d110f0ee116efa4d9a22d16dfd71 (patch) | |
tree | 3f664fe1b33402fb6a4f844a902c065cbd1c95b4 /src/transport | |
parent | c62fc947fac80856859ee2969616285d40c4682c (diff) | |
download | gnunet-adbb8b5d9635d110f0ee116efa4d9a22d16dfd71.tar.gz gnunet-adbb8b5d9635d110f0ee116efa4d9a22d16dfd71.zip |
remove CONNECT_SWITCHING_BLACKLIST state
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 220 | ||||
-rw-r--r-- | src/transport/transport_api_monitoring.c | 6 |
2 files changed, 53 insertions, 173 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 527c99ab5..a5deca66d 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -1106,10 +1106,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n) | |||
1106 | set_state (n, GNUNET_TRANSPORT_PS_DISCONNECT); | 1106 | set_state (n, GNUNET_TRANSPORT_PS_DISCONNECT); |
1107 | break; | 1107 | break; |
1108 | case GNUNET_TRANSPORT_PS_CONNECTED: | 1108 | case GNUNET_TRANSPORT_PS_CONNECTED: |
1109 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | ||
1110 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 1109 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
1111 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST: | ||
1112 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | ||
1113 | /* we are currently connected, need to send disconnect and do | 1110 | /* we are currently connected, need to send disconnect and do |
1114 | internal notifications and update statistics */ | 1111 | internal notifications and update statistics */ |
1115 | send_disconnect (n); | 1112 | send_disconnect (n); |
@@ -1299,7 +1296,6 @@ send_keepalive (struct NeighbourMapEntry *n) | |||
1299 | uint32_t nonce; | 1296 | uint32_t nonce; |
1300 | 1297 | ||
1301 | GNUNET_assert ((GNUNET_TRANSPORT_PS_CONNECTED == n->state) || | 1298 | GNUNET_assert ((GNUNET_TRANSPORT_PS_CONNECTED == n->state) || |
1302 | (GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST == n->state) || | ||
1303 | (GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT)); | 1299 | (GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT)); |
1304 | if (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time).rel_value_us > 0) | 1300 | if (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time).rel_value_us > 0) |
1305 | return; /* no keepalive needed at this time */ | 1301 | return; /* no keepalive needed at this time */ |
@@ -1643,7 +1639,8 @@ send_session_connect_cont (void *cls, | |||
1643 | return; | 1639 | return; |
1644 | } | 1640 | } |
1645 | 1641 | ||
1646 | if (GNUNET_TRANSPORT_PS_CONNECT_SENT != n->state) | 1642 | if ( (GNUNET_TRANSPORT_PS_CONNECT_SENT != n->state) && |
1643 | (GNUNET_TRANSPORT_PS_RECONNECT_SENT != n->state) ) | ||
1647 | { | 1644 | { |
1648 | /* CONNECT continuation was called after neighbor changed state, | 1645 | /* CONNECT continuation was called after neighbor changed state, |
1649 | * for example due to a time out for the state or the session | 1646 | * for example due to a time out for the state or the session |
@@ -1668,8 +1665,24 @@ send_session_connect_cont (void *cls, | |||
1668 | /* Remove address and request and additional one */ | 1665 | /* Remove address and request and additional one */ |
1669 | unset_primary_address (n); | 1666 | unset_primary_address (n); |
1670 | 1667 | ||
1671 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_INIT_ATS, | 1668 | if (n->state == GNUNET_TRANSPORT_PS_RECONNECT_SENT) |
1669 | { | ||
1670 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_ATS, | ||
1671 | GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); | ||
1672 | |||
1673 | } | ||
1674 | else if (n->state == GNUNET_TRANSPORT_PS_INIT_ATS) | ||
1675 | { | ||
1676 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_INIT_ATS, | ||
1672 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | 1677 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); |
1678 | } | ||
1679 | else | ||
1680 | { | ||
1681 | GNUNET_break (0); | ||
1682 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_INIT_ATS, | ||
1683 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | ||
1684 | } | ||
1685 | |||
1673 | return; | 1686 | return; |
1674 | } | 1687 | } |
1675 | 1688 | ||
@@ -1734,16 +1747,29 @@ send_session_connect (struct NeighbourAddress *na) | |||
1734 | 1747 | ||
1735 | /* Remove address and request and additional one */ | 1748 | /* Remove address and request and additional one */ |
1736 | unset_primary_address (n); | 1749 | unset_primary_address (n); |
1737 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_INIT_ATS, | 1750 | if (n->state == GNUNET_TRANSPORT_PS_RECONNECT_SENT) |
1751 | { | ||
1752 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_ATS, | ||
1753 | GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); | ||
1754 | |||
1755 | } | ||
1756 | else if (n->state == GNUNET_TRANSPORT_PS_INIT_ATS) | ||
1757 | { | ||
1758 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_INIT_ATS, | ||
1738 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | 1759 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); |
1760 | } | ||
1761 | else | ||
1762 | { | ||
1763 | GNUNET_break (0); | ||
1764 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_INIT_ATS, | ||
1765 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | ||
1766 | } | ||
1739 | return; | 1767 | return; |
1740 | } | 1768 | } |
1741 | |||
1742 | GST_neighbours_notify_data_sent (&na->address->peer, | 1769 | GST_neighbours_notify_data_sent (&na->address->peer, |
1743 | na->address, | 1770 | na->address, |
1744 | na->session, | 1771 | na->session, |
1745 | sizeof (struct SessionConnectMessage)); | 1772 | sizeof (struct SessionConnectMessage)); |
1746 | |||
1747 | } | 1773 | } |
1748 | 1774 | ||
1749 | 1775 | ||
@@ -2068,33 +2094,6 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer) | |||
2068 | return n; | 2094 | return n; |
2069 | } | 2095 | } |
2070 | 2096 | ||
2071 | |||
2072 | /** | ||
2073 | * Check if the two given addresses are the same. | ||
2074 | * Actually only checks if the sessions are non-NULL | ||
2075 | * (which they should be) and then if they are identical; | ||
2076 | * the actual addresses don't matter if the session | ||
2077 | * pointers match anyway, and we must have session pointers | ||
2078 | * at this time. | ||
2079 | * | ||
2080 | * @param a1 first address to compare | ||
2081 | * @param a2 other address to compare | ||
2082 | * @return #GNUNET_NO if the addresses do not match, #GNUNET_YES if they do match | ||
2083 | */ | ||
2084 | static int | ||
2085 | address_matches (const struct NeighbourAddress *a1, | ||
2086 | const struct NeighbourAddress *a2) | ||
2087 | { | ||
2088 | if ( (NULL == a1->session) || | ||
2089 | (NULL == a2->session) ) | ||
2090 | { | ||
2091 | GNUNET_break (0); | ||
2092 | return 0; | ||
2093 | } | ||
2094 | return (a1->session == a2->session) ? GNUNET_YES : GNUNET_NO; | ||
2095 | } | ||
2096 | |||
2097 | |||
2098 | /* We received a address suggestion after requesting an address in | 2097 | /* We received a address suggestion after requesting an address in |
2099 | * try_connect or after receiving a connect, switch to address | 2098 | * try_connect or after receiving a connect, switch to address |
2100 | */ | 2099 | */ |
@@ -2210,9 +2209,7 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target) | |||
2210 | return; /* already trying */ | 2209 | return; /* already trying */ |
2211 | case GNUNET_TRANSPORT_PS_CONNECTED: | 2210 | case GNUNET_TRANSPORT_PS_CONNECTED: |
2212 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: | 2211 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: |
2213 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | ||
2214 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 2212 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
2215 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST: | ||
2216 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | 2213 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: |
2217 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 2214 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2218 | "Ignoring request to try to connect, already connected to `%s'!\n", | 2215 | "Ignoring request to try to connect, already connected to `%s'!\n", |
@@ -2347,33 +2344,6 @@ handle_connect_blacklist_check_cont (void *cls, | |||
2347 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: | 2344 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: |
2348 | /* still waiting on ATS suggestion, don't care about blacklist */ | 2345 | /* still waiting on ATS suggestion, don't care about blacklist */ |
2349 | break; | 2346 | break; |
2350 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | ||
2351 | if ( (GNUNET_OK == result) && | ||
2352 | (ACK_SEND_CONNECT_ACK == n->ack_state) ) | ||
2353 | { | ||
2354 | n->ack_state = ACK_SEND_SESSION_ACK; | ||
2355 | send_connect_ack_message (bcc->na.address, | ||
2356 | bcc->na.session, | ||
2357 | n->connect_ack_timestamp); | ||
2358 | } | ||
2359 | if (GNUNET_YES != address_matches (&bcc->na, &n->primary_address)) | ||
2360 | { | ||
2361 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2362 | "Blacklist result ignored, as it is not for our primary address\n"); | ||
2363 | break; /* result for an address we currently don't care about */ | ||
2364 | } | ||
2365 | if (GNUNET_OK == result) | ||
2366 | { | ||
2367 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_SENT, | ||
2368 | GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); | ||
2369 | send_session_connect (&n->primary_address); | ||
2370 | } | ||
2371 | else | ||
2372 | { | ||
2373 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_ATS, | ||
2374 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | ||
2375 | } | ||
2376 | break; | ||
2377 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 2347 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
2378 | /* waiting on CONNECT_ACK, don't care about blacklist */ | 2348 | /* waiting on CONNECT_ACK, don't care about blacklist */ |
2379 | if ( (GNUNET_OK == result) && | 2349 | if ( (GNUNET_OK == result) && |
@@ -2385,24 +2355,6 @@ handle_connect_blacklist_check_cont (void *cls, | |||
2385 | n->connect_ack_timestamp); | 2355 | n->connect_ack_timestamp); |
2386 | } | 2356 | } |
2387 | break; | 2357 | break; |
2388 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST: | ||
2389 | if (GNUNET_YES != address_matches (&bcc->na, &n->alternative_address)) | ||
2390 | { | ||
2391 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2392 | "Blacklist result ignored, as it is not for our primary address\n"); | ||
2393 | break; /* result for an address we currently don't care about */ | ||
2394 | } | ||
2395 | if (GNUNET_OK == result) | ||
2396 | { | ||
2397 | send_session_connect (&n->alternative_address); | ||
2398 | set_state (n, GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT); | ||
2399 | } | ||
2400 | else | ||
2401 | { | ||
2402 | set_state(n, GNUNET_TRANSPORT_PS_CONNECTED); | ||
2403 | free_address (&n->alternative_address); | ||
2404 | } | ||
2405 | break; | ||
2406 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | 2358 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: |
2407 | /* waiting on CONNECT_ACK, don't care about blacklist */ | 2359 | /* waiting on CONNECT_ACK, don't care about blacklist */ |
2408 | if ( (GNUNET_OK == result) && | 2360 | if ( (GNUNET_OK == result) && |
@@ -2567,13 +2519,11 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | |||
2567 | connect_check_blacklist (peer, ts, address, session); | 2519 | connect_check_blacklist (peer, ts, address, session); |
2568 | break; | 2520 | break; |
2569 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: | 2521 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: |
2570 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | ||
2571 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 2522 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
2572 | /* It can never hurt to have an alternative address in the above cases, | 2523 | /* It can never hurt to have an alternative address in the above cases, |
2573 | see if it is allowed */ | 2524 | see if it is allowed */ |
2574 | connect_check_blacklist (peer, ts, address, session); | 2525 | connect_check_blacklist (peer, ts, address, session); |
2575 | break; | 2526 | break; |
2576 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST: | ||
2577 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | 2527 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: |
2578 | /* we are already connected and can thus send the ACK immediately; | 2528 | /* we are already connected and can thus send the ACK immediately; |
2579 | still, it can never hurt to have an alternative address, so also | 2529 | still, it can never hurt to have an alternative address, so also |
@@ -2764,52 +2714,27 @@ switch_address_bl_check_cont (void *cls, | |||
2764 | } | 2714 | } |
2765 | /* ATS asks us to switch a life connection; see if we can get | 2715 | /* ATS asks us to switch a life connection; see if we can get |
2766 | a CONNECT_ACK on it before we actually do this! */ | 2716 | a CONNECT_ACK on it before we actually do this! */ |
2767 | set_state (n, GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST); | ||
2768 | set_alternative_address (n, blc_ctx->address, blc_ctx->session, | 2717 | set_alternative_address (n, blc_ctx->address, blc_ctx->session, |
2769 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out); | 2718 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out); |
2770 | /* REMOVE */ connect_check_blacklist (&n->id, GNUNET_TIME_absolute_get (), | 2719 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT, |
2771 | blc_ctx->address, blc_ctx->session); | 2720 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); |
2721 | send_session_connect (&n->alternative_address); | ||
2772 | break; | 2722 | break; |
2773 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: | 2723 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: |
2774 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | 2724 | set_primary_address (n, blc_ctx->address, blc_ctx->session, |
2775 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | 2725 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); |
2776 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST, | 2726 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_SENT, |
2777 | GNUNET_TIME_relative_to_absolute (BLACKLIST_RESPONSE_TIMEOUT)); | 2727 | GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); |
2778 | /* REMOVE */ connect_check_blacklist (&n->id, n->connect_ack_timestamp, | 2728 | send_session_connect (&n->primary_address); |
2779 | blc_ctx->address, blc_ctx->session); | ||
2780 | break; | ||
2781 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | ||
2782 | /* ATS asks us to switch while we were trying to reconnect; switch to new | ||
2783 | address and check blacklist again */ | ||
2784 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | ||
2785 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | ||
2786 | set_timeout (n, GNUNET_TIME_relative_to_absolute (BLACKLIST_RESPONSE_TIMEOUT)); | ||
2787 | /* REMOVE */ connect_check_blacklist (&n->id, n->connect_ack_timestamp, | ||
2788 | blc_ctx->address, blc_ctx->session); | ||
2789 | break; | 2729 | break; |
2790 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 2730 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
2791 | /* ATS asks us to switch while we were trying to reconnect; switch to new | 2731 | /* ATS asks us to switch while we were trying to reconnect; switch to new |
2792 | address and check blacklist again */ | 2732 | address and send CONNECT again */ |
2793 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | ||
2794 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | ||
2795 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST, | ||
2796 | GNUNET_TIME_relative_to_absolute (BLACKLIST_RESPONSE_TIMEOUT)); | ||
2797 | /* REMOVE */ connect_check_blacklist (&n->id, n->connect_ack_timestamp, | ||
2798 | blc_ctx->address, blc_ctx->session); | ||
2799 | break; | ||
2800 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST: | ||
2801 | if (n->primary_address.session == blc_ctx->session) | ||
2802 | { | ||
2803 | /* ATS switches back to still-active session */ | ||
2804 | set_state(n, GNUNET_TRANSPORT_PS_CONNECTED); | ||
2805 | free_address (&n->alternative_address); | ||
2806 | break; | ||
2807 | } | ||
2808 | /* ATS asks us to switch a life connection, update blacklist check */ | ||
2809 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | 2733 | set_primary_address (n, blc_ctx->address, blc_ctx->session, |
2810 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | 2734 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); |
2811 | /* REMOVE */ connect_check_blacklist (&n->id, GNUNET_TIME_absolute_get (), | 2735 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_SENT, |
2812 | blc_ctx->address, blc_ctx->session); | 2736 | GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); |
2737 | send_session_connect (&n->primary_address); | ||
2813 | break; | 2738 | break; |
2814 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | 2739 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: |
2815 | if (n->primary_address.session == blc_ctx->session) | 2740 | if (n->primary_address.session == blc_ctx->session) |
@@ -2819,12 +2744,12 @@ switch_address_bl_check_cont (void *cls, | |||
2819 | set_state (n, GNUNET_TRANSPORT_PS_CONNECTED); | 2744 | set_state (n, GNUNET_TRANSPORT_PS_CONNECTED); |
2820 | break; | 2745 | break; |
2821 | } | 2746 | } |
2822 | /* ATS asks us to switch a life connection, update blacklist check */ | 2747 | /* ATS asks us to switch a life connection, send */ |
2823 | set_state (n, GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST); | ||
2824 | set_alternative_address (n, blc_ctx->address, blc_ctx->session, | 2748 | set_alternative_address (n, blc_ctx->address, blc_ctx->session, |
2825 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out); | 2749 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out); |
2826 | /* REMOVE */ connect_check_blacklist (&n->id, GNUNET_TIME_absolute_get (), | 2750 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT, |
2827 | blc_ctx->address, blc_ctx->session); | 2751 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); |
2752 | send_session_connect (&n->alternative_address); | ||
2828 | break; | 2753 | break; |
2829 | case GNUNET_TRANSPORT_PS_DISCONNECT: | 2754 | case GNUNET_TRANSPORT_PS_DISCONNECT: |
2830 | /* not going to switch addresses while disconnecting */ | 2755 | /* not going to switch addresses while disconnecting */ |
@@ -3190,16 +3115,6 @@ master_task (void *cls, | |||
3190 | return; | 3115 | return; |
3191 | } | 3116 | } |
3192 | break; | 3117 | break; |
3193 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | ||
3194 | if (0 == delay.rel_value_us) | ||
3195 | { | ||
3196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3197 | "Connection to `%s' timed out, waiting for BLACKLIST to approve replacement address\n", | ||
3198 | GNUNET_i2s (&n->id)); | ||
3199 | disconnect_neighbour (n); | ||
3200 | return; | ||
3201 | } | ||
3202 | break; | ||
3203 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 3118 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
3204 | if (0 == delay.rel_value_us) | 3119 | if (0 == delay.rel_value_us) |
3205 | { | 3120 | { |
@@ -3210,18 +3125,6 @@ master_task (void *cls, | |||
3210 | return; | 3125 | return; |
3211 | } | 3126 | } |
3212 | break; | 3127 | break; |
3213 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST: | ||
3214 | if (0 == delay.rel_value_us) | ||
3215 | { | ||
3216 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3217 | "Connection to `%s' timed out, missing KEEPALIVE_RESPONSEs\n", | ||
3218 | GNUNET_i2s (&n->id)); | ||
3219 | disconnect_neighbour (n); | ||
3220 | return; | ||
3221 | } | ||
3222 | try_transmission_to_peer (n); | ||
3223 | send_keepalive (n); | ||
3224 | break; | ||
3225 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | 3128 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: |
3226 | if (0 == delay.rel_value_us) | 3129 | if (0 == delay.rel_value_us) |
3227 | { | 3130 | { |
@@ -3252,10 +3155,9 @@ master_task (void *cls, | |||
3252 | break; | 3155 | break; |
3253 | } | 3156 | } |
3254 | if ( (GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT == n->state) || | 3157 | if ( (GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT == n->state) || |
3255 | (GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST == n->state) || | ||
3256 | (GNUNET_TRANSPORT_PS_CONNECTED == n->state) ) | 3158 | (GNUNET_TRANSPORT_PS_CONNECTED == n->state) ) |
3257 | { | 3159 | { |
3258 | /* if we are *now* in one of these three states, we're sending | 3160 | /* if we are *now* in one of the two states, we're sending |
3259 | keep alive messages, so we need to consider the keepalive | 3161 | keep alive messages, so we need to consider the keepalive |
3260 | delay, not just the connection timeout */ | 3162 | delay, not just the connection timeout */ |
3261 | delay = GNUNET_TIME_relative_min (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time), | 3163 | delay = GNUNET_TIME_relative_min (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time), |
@@ -3385,7 +3287,6 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | |||
3385 | send_session_ack_message (n); | 3287 | send_session_ack_message (n); |
3386 | break; | 3288 | break; |
3387 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: | 3289 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: |
3388 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | ||
3389 | /* we didn't expect any CONNECT_ACK, as we are waiting for ATS | 3290 | /* we didn't expect any CONNECT_ACK, as we are waiting for ATS |
3390 | to give us a new address... */ | 3291 | to give us a new address... */ |
3391 | GNUNET_STATISTICS_update (GST_stats, | 3292 | GNUNET_STATISTICS_update (GST_stats, |
@@ -3399,10 +3300,6 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | |||
3399 | GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT)); | 3300 | GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT)); |
3400 | send_session_ack_message (n); | 3301 | send_session_ack_message (n); |
3401 | break; | 3302 | break; |
3402 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST: | ||
3403 | /* duplicate CONNECT_ACK, let's answer by duplciate SESSION_ACK just in case */ | ||
3404 | send_session_ack_message (n); | ||
3405 | break; | ||
3406 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | 3303 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: |
3407 | /* new address worked; adopt it and go back to connected! */ | 3304 | /* new address worked; adopt it and go back to connected! */ |
3408 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_CONNECTED, | 3305 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_CONNECTED, |
@@ -3478,8 +3375,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, | |||
3478 | { | 3375 | { |
3479 | if (session == n->alternative_address.session) | 3376 | if (session == n->alternative_address.session) |
3480 | { | 3377 | { |
3481 | if ( (GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST == n->state) || | 3378 | if ( (GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT == n->state) ) |
3482 | (GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT == n->state) ) | ||
3483 | set_state (n, GNUNET_TRANSPORT_PS_CONNECTED); | 3379 | set_state (n, GNUNET_TRANSPORT_PS_CONNECTED); |
3484 | else | 3380 | else |
3485 | GNUNET_break (0); | 3381 | GNUNET_break (0); |
@@ -3527,25 +3423,17 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, | |||
3527 | /* we don't have an address, how can it go down? */ | 3423 | /* we don't have an address, how can it go down? */ |
3528 | GNUNET_break (0); | 3424 | GNUNET_break (0); |
3529 | break; | 3425 | break; |
3530 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | ||
3531 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 3426 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
3532 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_ATS, GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | 3427 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_ATS, GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); |
3533 | break; | 3428 | break; |
3534 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST: | ||
3535 | /* primary went down while we were checking secondary against | ||
3536 | blacklist, adopt secondary as primary */ | ||
3537 | free_address (&n->primary_address); | ||
3538 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST, GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); | ||
3539 | n->primary_address = n->alternative_address; | ||
3540 | memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress)); | ||
3541 | break; | ||
3542 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | 3429 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: |
3543 | /* primary went down while we were waiting for CONNECT_ACK on secondary; | 3430 | /* primary went down while we were waiting for CONNECT_ACK on secondary; |
3544 | secondary as primary */ | 3431 | secondary as primary */ |
3432 | GNUNET_ATS_address_destroyed (GST_ats, n->primary_address.address, NULL); | ||
3545 | free_address (&n->primary_address); | 3433 | free_address (&n->primary_address); |
3546 | n->primary_address = n->alternative_address; | 3434 | n->primary_address = n->alternative_address; |
3547 | memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress)); | 3435 | memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress)); |
3548 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_SENT, GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); | 3436 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_ATS, GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); |
3549 | break; | 3437 | break; |
3550 | case GNUNET_TRANSPORT_PS_DISCONNECT: | 3438 | case GNUNET_TRANSPORT_PS_DISCONNECT: |
3551 | free_address (&n->primary_address); | 3439 | free_address (&n->primary_address); |
@@ -3904,10 +3792,8 @@ GST_neighbour_get_latency (const struct GNUNET_PeerIdentity *peer) | |||
3904 | { | 3792 | { |
3905 | case GNUNET_TRANSPORT_PS_CONNECTED: | 3793 | case GNUNET_TRANSPORT_PS_CONNECTED: |
3906 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | 3794 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: |
3907 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST: | ||
3908 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 3795 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
3909 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: | 3796 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: |
3910 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | ||
3911 | return n->latency; | 3797 | return n->latency; |
3912 | case GNUNET_TRANSPORT_PS_NOT_CONNECTED: | 3798 | case GNUNET_TRANSPORT_PS_NOT_CONNECTED: |
3913 | case GNUNET_TRANSPORT_PS_INIT_ATS: | 3799 | case GNUNET_TRANSPORT_PS_INIT_ATS: |
diff --git a/src/transport/transport_api_monitoring.c b/src/transport/transport_api_monitoring.c index d926c0d4f..f8dfc9ead 100644 --- a/src/transport/transport_api_monitoring.c +++ b/src/transport/transport_api_monitoring.c | |||
@@ -159,9 +159,7 @@ GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state) | |||
159 | return GNUNET_NO; | 159 | return GNUNET_NO; |
160 | case GNUNET_TRANSPORT_PS_CONNECTED: | 160 | case GNUNET_TRANSPORT_PS_CONNECTED: |
161 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: | 161 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: |
162 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | ||
163 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 162 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
164 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST: | ||
165 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | 163 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: |
166 | return GNUNET_YES; | 164 | return GNUNET_YES; |
167 | case GNUNET_TRANSPORT_PS_DISCONNECT: | 165 | case GNUNET_TRANSPORT_PS_DISCONNECT: |
@@ -202,12 +200,8 @@ GNUNET_TRANSPORT_ps2s (enum GNUNET_TRANSPORT_PeerState state) | |||
202 | return "S_CONNECTED"; | 200 | return "S_CONNECTED"; |
203 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: | 201 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: |
204 | return "S_RECONNECT_ATS"; | 202 | return "S_RECONNECT_ATS"; |
205 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | ||
206 | return "S_RECONNECT_BLACKLIST"; | ||
207 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 203 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
208 | return "S_RECONNECT_SENT"; | 204 | return "S_RECONNECT_SENT"; |
209 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_BLACKLIST: | ||
210 | return "S_CONNECTED_SWITCHING_BLACKLIST"; | ||
211 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | 205 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: |
212 | return "S_CONNECTED_SWITCHING_CONNECT_SENT"; | 206 | return "S_CONNECTED_SWITCHING_CONNECT_SENT"; |
213 | case GNUNET_TRANSPORT_PS_DISCONNECT: | 207 | case GNUNET_TRANSPORT_PS_DISCONNECT: |