diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-03 00:23:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-03 00:23:10 +0000 |
commit | cb306ceb0483be233d0f374d118c6e82afd62dde (patch) | |
tree | 32d74755eb6bc2e57e1072b2732b6d88eba0462c | |
parent | 8135b399e1f9cac35602277806d71438def72010 (diff) | |
download | gnunet-cb306ceb0483be233d0f374d118c6e82afd62dde.tar.gz gnunet-cb306ceb0483be233d0f374d118c6e82afd62dde.zip |
adding statistics on why transport may drop ATS suggestions
-rw-r--r-- | src/transport/gnunet-service-transport.c | 13 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 229 | ||||
-rw-r--r-- | src/transport/test_transport_api.c | 2 |
3 files changed, 170 insertions, 74 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 8f6767c97..936a82bb0 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -832,7 +832,10 @@ ats_request_address_change (void *cls, | |||
832 | GST_neighbours_force_disconnect (&address->peer); | 832 | GST_neighbours_force_disconnect (&address->peer); |
833 | return; | 833 | return; |
834 | } | 834 | } |
835 | 835 | GNUNET_STATISTICS_update (GST_stats, | |
836 | "# ATS suggestions received", | ||
837 | 1, | ||
838 | GNUNET_NO); | ||
836 | GST_neighbours_switch_to_address (address, | 839 | GST_neighbours_switch_to_address (address, |
837 | session, | 840 | session, |
838 | bandwidth_in, bandwidth_out); | 841 | bandwidth_in, bandwidth_out); |
@@ -901,9 +904,11 @@ run (void *cls, | |||
901 | 904 | ||
902 | /* setup globals */ | 905 | /* setup globals */ |
903 | GST_cfg = c; | 906 | GST_cfg = c; |
904 | if (GNUNET_OK | 907 | if (GNUNET_OK != |
905 | != GNUNET_CONFIGURATION_get_value_filename (c, "PEER", "PRIVATE_KEY", | 908 | GNUNET_CONFIGURATION_get_value_filename (c, |
906 | &keyfile)) | 909 | "PEER", |
910 | "PRIVATE_KEY", | ||
911 | &keyfile)) | ||
907 | { | 912 | { |
908 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 913 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
909 | _("Transport service is lacking key configuration settings. Exiting.\n")); | 914 | _("Transport service is lacking key configuration settings. Exiting.\n")); |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index b400ac7fb..7df23c2c2 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -2412,31 +2412,44 @@ switch_address_bl_check_cont (void *cls, | |||
2412 | 2412 | ||
2413 | papi = GST_plugins_find (blc_ctx->address->transport_name); | 2413 | papi = GST_plugins_find (blc_ctx->address->transport_name); |
2414 | 2414 | ||
2415 | if ( (NULL == (n = lookup_neighbour (peer))) || (result == GNUNET_NO) || | 2415 | if ( (NULL == (n = lookup_neighbour (peer))) || |
2416 | (NULL == (papi)) ) | 2416 | (result == GNUNET_NO) || |
2417 | (NULL == papi) ) | ||
2417 | { | 2418 | { |
2418 | if (NULL == n) | 2419 | if (NULL == n) |
2419 | { | 2420 | { |
2420 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2421 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2421 | "Peer %s is unknown, suggestion ignored\n", | 2422 | "Peer %s is unknown, suggestion ignored\n", |
2422 | GNUNET_i2s (peer)); | 2423 | GNUNET_i2s (peer)); |
2424 | GNUNET_STATISTICS_update (GST_stats, | ||
2425 | "# ATS suggestions ignored (neighbour unknown)", | ||
2426 | 1, | ||
2427 | GNUNET_NO); | ||
2423 | } | 2428 | } |
2424 | if (result == GNUNET_NO) | 2429 | if (result == GNUNET_NO) |
2425 | { | 2430 | { |
2426 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2431 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2427 | "Blacklist denied to switch to suggested address `%s' session %p for peer `%s'\n", | 2432 | "Blacklist denied to switch to suggested address `%s' session %p for peer `%s'\n", |
2428 | GST_plugins_a2s (blc_ctx->address), | 2433 | GST_plugins_a2s (blc_ctx->address), |
2429 | blc_ctx->session, | 2434 | blc_ctx->session, |
2430 | GNUNET_i2s (&blc_ctx->address->peer)); | 2435 | GNUNET_i2s (&blc_ctx->address->peer)); |
2436 | GNUNET_STATISTICS_update (GST_stats, | ||
2437 | "# ATS suggestions ignored (blacklist denied)", | ||
2438 | 1, | ||
2439 | GNUNET_NO); | ||
2431 | } | 2440 | } |
2432 | if (NULL == papi) | 2441 | if (NULL == papi) |
2433 | { | 2442 | { |
2434 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2443 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2435 | "Plugin `%s' for suggested address `%s' session %p for peer `%s' is not available\n", | 2444 | "Plugin `%s' for suggested address `%s' session %p for peer `%s' is not available\n", |
2436 | blc_ctx->address->transport_name, | 2445 | blc_ctx->address->transport_name, |
2437 | GST_plugins_a2s (blc_ctx->address), | 2446 | GST_plugins_a2s (blc_ctx->address), |
2438 | blc_ctx->session, | 2447 | blc_ctx->session, |
2439 | GNUNET_i2s (&blc_ctx->address->peer)); | 2448 | GNUNET_i2s (&blc_ctx->address->peer)); |
2449 | GNUNET_STATISTICS_update (GST_stats, | ||
2450 | "# ATS suggestions ignored (plugin unknown)", | ||
2451 | 1, | ||
2452 | GNUNET_NO); | ||
2440 | } | 2453 | } |
2441 | 2454 | ||
2442 | /* This address is blacklisted, delete session */ | 2455 | /* This address is blacklisted, delete session */ |
@@ -2467,12 +2480,16 @@ switch_address_bl_check_cont (void *cls, | |||
2467 | } | 2480 | } |
2468 | if (NULL == blc_ctx->session) | 2481 | if (NULL == blc_ctx->session) |
2469 | { | 2482 | { |
2483 | GNUNET_STATISTICS_update (GST_stats, | ||
2484 | "# ATS suggestions ignored (failed to create session)", | ||
2485 | 1, | ||
2486 | GNUNET_NO); | ||
2470 | /* No session could be obtained, remove blacklist check and clean up */ | 2487 | /* No session could be obtained, remove blacklist check and clean up */ |
2471 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2488 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2472 | "Failed to obtain new session for peer `%s' and address '%s'\n", | 2489 | "Failed to obtain new session for peer `%s' and address '%s'\n", |
2473 | GNUNET_i2s (&blc_ctx->address->peer), | 2490 | GNUNET_i2s (&blc_ctx->address->peer), |
2474 | GST_plugins_a2s (blc_ctx->address)); | 2491 | GST_plugins_a2s (blc_ctx->address)); |
2475 | /* Delete address in ATS */ | 2492 | /* FIXME: Delete address in ATS!? */ |
2476 | GNUNET_CONTAINER_DLL_remove (pending_bc_head, | 2493 | GNUNET_CONTAINER_DLL_remove (pending_bc_head, |
2477 | pending_bc_tail, | 2494 | pending_bc_tail, |
2478 | blc_ctx); | 2495 | blc_ctx); |
@@ -2482,32 +2499,44 @@ switch_address_bl_check_cont (void *cls, | |||
2482 | } | 2499 | } |
2483 | 2500 | ||
2484 | if ( (NULL != n->primary_address.address) && | 2501 | if ( (NULL != n->primary_address.address) && |
2485 | (0 == GNUNET_HELLO_address_cmp(blc_ctx->address, n->primary_address.address)) ) | 2502 | (0 == GNUNET_HELLO_address_cmp (blc_ctx->address, |
2503 | n->primary_address.address)) ) | ||
2486 | { | 2504 | { |
2487 | if (blc_ctx->session == n->primary_address.session) | 2505 | if (blc_ctx->session == n->primary_address.session) |
2488 | { | 2506 | { |
2507 | // FIXME: handle this before blacklist check! | ||
2489 | /* This address is already primary, update only quotas */ | 2508 | /* This address is already primary, update only quotas */ |
2490 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2509 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2491 | "Updating quota for peer `%s' address `%s' session %p\n", | 2510 | "Updating quota for peer `%s' address `%s' session %p\n", |
2492 | GNUNET_i2s (&blc_ctx->address->peer), | 2511 | GNUNET_i2s (&blc_ctx->address->peer), |
2493 | GST_plugins_a2s (blc_ctx->address), | 2512 | GST_plugins_a2s (blc_ctx->address), |
2494 | blc_ctx->session); | 2513 | blc_ctx->session); |
2495 | 2514 | set_primary_address (n, | |
2496 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | 2515 | blc_ctx->address, |
2497 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | 2516 | blc_ctx->session, |
2498 | 2517 | blc_ctx->bandwidth_in, | |
2499 | GNUNET_CONTAINER_DLL_remove (pending_bc_head, pending_bc_tail, blc_ctx); | 2518 | blc_ctx->bandwidth_out, |
2500 | GNUNET_HELLO_address_free(blc_ctx->address); | 2519 | GNUNET_NO); |
2520 | |||
2521 | GNUNET_CONTAINER_DLL_remove (pending_bc_head, | ||
2522 | pending_bc_tail, | ||
2523 | blc_ctx); | ||
2524 | GNUNET_HELLO_address_free (blc_ctx->address); | ||
2501 | GNUNET_free (blc_ctx); | 2525 | GNUNET_free (blc_ctx); |
2502 | return; | 2526 | return; |
2503 | } | 2527 | } |
2528 | // FIXME: is this really OK? | ||
2529 | GNUNET_STATISTICS_update (GST_stats, | ||
2530 | "# ATS suggestion oddity (address match, session missmatch)", | ||
2531 | 1, | ||
2532 | GNUNET_NO); | ||
2504 | } | 2533 | } |
2505 | 2534 | ||
2506 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 2535 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2507 | "Peer `%s' switches to address `%s' session %p\n", | 2536 | "Peer `%s' switches to address `%s' session %p\n", |
2508 | GNUNET_i2s (&blc_ctx->address->peer), | 2537 | GNUNET_i2s (&blc_ctx->address->peer), |
2509 | GST_plugins_a2s (blc_ctx->address), | 2538 | GST_plugins_a2s (blc_ctx->address), |
2510 | blc_ctx->session); | 2539 | blc_ctx->session); |
2511 | 2540 | ||
2512 | switch (n->state) | 2541 | switch (n->state) |
2513 | { | 2542 | { |
@@ -2518,44 +2547,61 @@ switch_address_bl_check_cont (void *cls, | |||
2518 | case GNUNET_TRANSPORT_PS_INIT_ATS: | 2547 | case GNUNET_TRANSPORT_PS_INIT_ATS: |
2519 | /* We requested an address and ATS suggests one: | 2548 | /* We requested an address and ATS suggests one: |
2520 | * set primary address and send SYN message*/ | 2549 | * set primary address and send SYN message*/ |
2521 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | 2550 | set_primary_address (n, |
2522 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | 2551 | blc_ctx->address, |
2552 | blc_ctx->session, | ||
2553 | blc_ctx->bandwidth_in, | ||
2554 | blc_ctx->bandwidth_out, | ||
2555 | GNUNET_NO); | ||
2523 | if ( (ACK_SEND_SYN_ACK == n->ack_state) ) | 2556 | if ( (ACK_SEND_SYN_ACK == n->ack_state) ) |
2524 | { | 2557 | { |
2525 | /* Send pending SYN_ACK message */ | 2558 | /* Send pending SYN_ACK message */ |
2526 | n->ack_state = ACK_SEND_ACK; | 2559 | n->ack_state = ACK_SEND_ACK; |
2527 | send_connect_ack_message (n->primary_address.address, | 2560 | send_connect_ack_message (n->primary_address.address, |
2528 | n->primary_address.session, n->connect_ack_timestamp); | 2561 | n->primary_address.session, |
2562 | n->connect_ack_timestamp); | ||
2529 | } | 2563 | } |
2530 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_SYN_SENT, | 2564 | set_state_and_timeout (n, |
2531 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); | 2565 | GNUNET_TRANSPORT_PS_SYN_SENT, |
2566 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); | ||
2532 | send_syn (&n->primary_address); | 2567 | send_syn (&n->primary_address); |
2533 | break; | 2568 | break; |
2534 | case GNUNET_TRANSPORT_PS_SYN_SENT: | 2569 | case GNUNET_TRANSPORT_PS_SYN_SENT: |
2535 | /* ATS suggested a new address while waiting for an SYN_ACK: | 2570 | /* ATS suggested a new address while waiting for an SYN_ACK: |
2536 | * Switch and send new SYN */ | 2571 | * Switch and send new SYN */ |
2537 | /* ATS suggests a different address, switch again */ | 2572 | /* ATS suggests a different address, switch again */ |
2538 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | 2573 | set_primary_address (n, |
2539 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | 2574 | blc_ctx->address, |
2575 | blc_ctx->session, | ||
2576 | blc_ctx->bandwidth_in, | ||
2577 | blc_ctx->bandwidth_out, | ||
2578 | GNUNET_NO); | ||
2540 | if (ACK_SEND_SYN_ACK == n->ack_state) | 2579 | if (ACK_SEND_SYN_ACK == n->ack_state) |
2541 | { | 2580 | { |
2542 | /* Send pending SYN_ACK message */ | 2581 | /* Send pending SYN_ACK message */ |
2543 | n->ack_state = ACK_SEND_ACK; | 2582 | n->ack_state = ACK_SEND_ACK; |
2544 | send_connect_ack_message (n->primary_address.address, | 2583 | send_connect_ack_message (n->primary_address.address, |
2545 | n->primary_address.session, n->connect_ack_timestamp); | 2584 | n->primary_address.session, |
2585 | n->connect_ack_timestamp); | ||
2546 | } | 2586 | } |
2547 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_SYN_SENT, | 2587 | set_state_and_timeout (n, |
2548 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); | 2588 | GNUNET_TRANSPORT_PS_SYN_SENT, |
2589 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); | ||
2549 | send_syn (&n->primary_address); | 2590 | send_syn (&n->primary_address); |
2550 | break; | 2591 | break; |
2551 | case GNUNET_TRANSPORT_PS_SYN_RECV_ATS: | 2592 | case GNUNET_TRANSPORT_PS_SYN_RECV_ATS: |
2552 | /* We requested an address and ATS suggests one: | 2593 | /* We requested an address and ATS suggests one: |
2553 | * set primary address and send SYN_ACK message*/ | 2594 | * set primary address and send SYN_ACK message*/ |
2554 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | 2595 | set_primary_address (n, |
2555 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | 2596 | blc_ctx->address, |
2597 | blc_ctx->session, | ||
2598 | blc_ctx->bandwidth_in, | ||
2599 | blc_ctx->bandwidth_out, | ||
2600 | GNUNET_NO); | ||
2556 | /* Send an ACK message as a response to the SYN msg */ | 2601 | /* Send an ACK message as a response to the SYN msg */ |
2557 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_SYN_RECV_ACK, | 2602 | set_state_and_timeout (n, |
2558 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); | 2603 | GNUNET_TRANSPORT_PS_SYN_RECV_ACK, |
2604 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); | ||
2559 | send_connect_ack_message (n->primary_address.address, | 2605 | send_connect_ack_message (n->primary_address.address, |
2560 | n->primary_address.session, | 2606 | n->primary_address.session, |
2561 | n->connect_ack_timestamp); | 2607 | n->connect_ack_timestamp); |
@@ -2570,12 +2616,18 @@ switch_address_bl_check_cont (void *cls, | |||
2570 | { | 2616 | { |
2571 | n->ack_state = ACK_SEND_ACK; | 2617 | n->ack_state = ACK_SEND_ACK; |
2572 | send_connect_ack_message (n->primary_address.address, | 2618 | send_connect_ack_message (n->primary_address.address, |
2573 | n->primary_address.session, n->connect_ack_timestamp); | 2619 | n->primary_address.session, |
2620 | n->connect_ack_timestamp); | ||
2574 | } | 2621 | } |
2575 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | 2622 | set_primary_address (n, |
2576 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | 2623 | blc_ctx->address, |
2577 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_SYN_RECV_ACK, | 2624 | blc_ctx->session, |
2578 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); | 2625 | blc_ctx->bandwidth_in, |
2626 | blc_ctx->bandwidth_out, | ||
2627 | GNUNET_NO); | ||
2628 | set_state_and_timeout (n, | ||
2629 | GNUNET_TRANSPORT_PS_SYN_RECV_ACK, | ||
2630 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); | ||
2579 | break; | 2631 | break; |
2580 | case GNUNET_TRANSPORT_PS_CONNECTED: | 2632 | case GNUNET_TRANSPORT_PS_CONNECTED: |
2581 | GNUNET_assert (NULL != n->primary_address.address); | 2633 | GNUNET_assert (NULL != n->primary_address.address); |
@@ -2583,46 +2635,68 @@ switch_address_bl_check_cont (void *cls, | |||
2583 | if (n->primary_address.session == blc_ctx->session) | 2635 | if (n->primary_address.session == blc_ctx->session) |
2584 | { | 2636 | { |
2585 | /* not an address change, just a quota change */ | 2637 | /* not an address change, just a quota change */ |
2586 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | 2638 | // FIXME: this case should have been caught above! |
2587 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_YES); | 2639 | set_primary_address (n, |
2640 | blc_ctx->address, | ||
2641 | blc_ctx->session, | ||
2642 | blc_ctx->bandwidth_in, | ||
2643 | blc_ctx->bandwidth_out, | ||
2644 | GNUNET_YES); | ||
2588 | break; | 2645 | break; |
2589 | } | 2646 | } |
2590 | /* ATS asks us to switch a life connection; see if we can get | 2647 | /* ATS asks us to switch a life connection; see if we can get |
2591 | a SYN_ACK on it before we actually do this! */ | 2648 | a SYN_ACK on it before we actually do this! */ |
2592 | set_alternative_address (n, blc_ctx->address, blc_ctx->session, | 2649 | set_alternative_address (n, |
2593 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out); | 2650 | blc_ctx->address, |
2651 | blc_ctx->session, | ||
2652 | blc_ctx->bandwidth_in, | ||
2653 | blc_ctx->bandwidth_out); | ||
2594 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT, | 2654 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT, |
2595 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); | 2655 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); |
2596 | GNUNET_STATISTICS_update (GST_stats, gettext_noop | 2656 | GNUNET_STATISTICS_update (GST_stats, |
2597 | ("# Attempts to switch addresses"), 1, GNUNET_NO); | 2657 | gettext_noop ("# Attempts to switch addresses"), |
2658 | 1, | ||
2659 | GNUNET_NO); | ||
2598 | send_syn (&n->alternative_address); | 2660 | send_syn (&n->alternative_address); |
2599 | break; | 2661 | break; |
2600 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: | 2662 | case GNUNET_TRANSPORT_PS_RECONNECT_ATS: |
2601 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | 2663 | set_primary_address (n, |
2602 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | 2664 | blc_ctx->address, |
2603 | if ( (ACK_SEND_SYN_ACK == n->ack_state) ) | 2665 | blc_ctx->session, |
2666 | blc_ctx->bandwidth_in, | ||
2667 | blc_ctx->bandwidth_out, | ||
2668 | GNUNET_NO); | ||
2669 | if (ACK_SEND_SYN_ACK == n->ack_state) | ||
2604 | { | 2670 | { |
2605 | /* Send pending SYN_ACK message */ | 2671 | /* Send pending SYN_ACK message */ |
2606 | n->ack_state = ACK_SEND_ACK; | 2672 | n->ack_state = ACK_SEND_ACK; |
2607 | send_connect_ack_message (n->primary_address.address, | 2673 | send_connect_ack_message (n->primary_address.address, |
2608 | n->primary_address.session, n->connect_ack_timestamp); | 2674 | n->primary_address.session, |
2675 | n->connect_ack_timestamp); | ||
2609 | } | 2676 | } |
2610 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_SENT, | 2677 | set_state_and_timeout (n, |
2611 | GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); | 2678 | GNUNET_TRANSPORT_PS_RECONNECT_SENT, |
2679 | GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); | ||
2612 | send_syn (&n->primary_address); | 2680 | send_syn (&n->primary_address); |
2613 | break; | 2681 | break; |
2614 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 2682 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
2615 | /* ATS asks us to switch while we were trying to reconnect; switch to new | 2683 | /* ATS asks us to switch while we were trying to reconnect; switch to new |
2616 | address and send SYN again */ | 2684 | address and send SYN again */ |
2617 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | 2685 | set_primary_address (n, |
2618 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | 2686 | blc_ctx->address, |
2619 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_SENT, | 2687 | blc_ctx->session, |
2620 | GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); | 2688 | blc_ctx->bandwidth_in, |
2689 | blc_ctx->bandwidth_out, | ||
2690 | GNUNET_NO); | ||
2691 | set_state_and_timeout (n, | ||
2692 | GNUNET_TRANSPORT_PS_RECONNECT_SENT, | ||
2693 | GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); | ||
2621 | send_syn (&n->primary_address); | 2694 | send_syn (&n->primary_address); |
2622 | break; | 2695 | break; |
2623 | case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT: | 2696 | case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT: |
2624 | if ( (0 == GNUNET_HELLO_address_cmp(n->primary_address.address, | 2697 | if ( (0 == GNUNET_HELLO_address_cmp(n->primary_address.address, |
2625 | blc_ctx->address) && n->primary_address.session == blc_ctx->session) ) | 2698 | blc_ctx->address)) && |
2699 | (n->primary_address.session == blc_ctx->session) ) | ||
2626 | { | 2700 | { |
2627 | /* ATS switches back to still-active session */ | 2701 | /* ATS switches back to still-active session */ |
2628 | free_address (&n->alternative_address); | 2702 | free_address (&n->alternative_address); |
@@ -2630,14 +2704,22 @@ switch_address_bl_check_cont (void *cls, | |||
2630 | break; | 2704 | break; |
2631 | } | 2705 | } |
2632 | /* ATS asks us to switch a life connection, send */ | 2706 | /* ATS asks us to switch a life connection, send */ |
2633 | set_alternative_address (n, blc_ctx->address, blc_ctx->session, | 2707 | set_alternative_address (n, |
2634 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out); | 2708 | blc_ctx->address, |
2635 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT, | 2709 | blc_ctx->session, |
2636 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); | 2710 | blc_ctx->bandwidth_in, |
2711 | blc_ctx->bandwidth_out); | ||
2712 | set_state_and_timeout (n, | ||
2713 | GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT, | ||
2714 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); | ||
2637 | send_syn (&n->alternative_address); | 2715 | send_syn (&n->alternative_address); |
2638 | break; | 2716 | break; |
2639 | case GNUNET_TRANSPORT_PS_DISCONNECT: | 2717 | case GNUNET_TRANSPORT_PS_DISCONNECT: |
2640 | /* not going to switch addresses while disconnecting */ | 2718 | /* not going to switch addresses while disconnecting */ |
2719 | GNUNET_STATISTICS_update (GST_stats, | ||
2720 | "# ATS suggestion ignored (disconnecting)", | ||
2721 | 1, | ||
2722 | GNUNET_NO); | ||
2641 | return; | 2723 | return; |
2642 | case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED: | 2724 | case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED: |
2643 | GNUNET_assert (0); | 2725 | GNUNET_assert (0); |
@@ -2650,7 +2732,9 @@ switch_address_bl_check_cont (void *cls, | |||
2650 | break; | 2732 | break; |
2651 | } | 2733 | } |
2652 | 2734 | ||
2653 | GNUNET_CONTAINER_DLL_remove (pending_bc_head, pending_bc_tail, blc_ctx); | 2735 | GNUNET_CONTAINER_DLL_remove (pending_bc_head, |
2736 | pending_bc_tail, | ||
2737 | blc_ctx); | ||
2654 | GNUNET_HELLO_address_free (blc_ctx->address); | 2738 | GNUNET_HELLO_address_free (blc_ctx->address); |
2655 | GNUNET_free (blc_ctx); | 2739 | GNUNET_free (blc_ctx); |
2656 | } | 2740 | } |
@@ -2688,6 +2772,10 @@ GST_neighbours_switch_to_address (const struct GNUNET_HELLO_Address *address, | |||
2688 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2772 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2689 | "Peer %s is unknown, suggestion ignored\n", | 2773 | "Peer %s is unknown, suggestion ignored\n", |
2690 | GNUNET_i2s (&address->peer)); | 2774 | GNUNET_i2s (&address->peer)); |
2775 | GNUNET_STATISTICS_update (GST_stats, | ||
2776 | "# ATS suggestions ignored (neighbour unknown)", | ||
2777 | 1, | ||
2778 | GNUNET_NO); | ||
2691 | return; | 2779 | return; |
2692 | } | 2780 | } |
2693 | 2781 | ||
@@ -2718,6 +2806,9 @@ GST_neighbours_switch_to_address (const struct GNUNET_HELLO_Address *address, | |||
2718 | GNUNET_TRANSPORT_ps2s (n->state), | 2806 | GNUNET_TRANSPORT_ps2s (n->state), |
2719 | print_ack_state (n->ack_state)); | 2807 | print_ack_state (n->ack_state)); |
2720 | 2808 | ||
2809 | // FIXME: definitively do NOT do this if the | ||
2810 | // suggested address did not change!!! | ||
2811 | |||
2721 | /* Perform blacklist check */ | 2812 | /* Perform blacklist check */ |
2722 | blc_ctx = GNUNET_new (struct BlacklistCheckSwitchContext); | 2813 | blc_ctx = GNUNET_new (struct BlacklistCheckSwitchContext); |
2723 | blc_ctx->address = GNUNET_HELLO_address_copy (address); | 2814 | blc_ctx->address = GNUNET_HELLO_address_copy (address); |
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index ce6db8ad1..239ecdfed 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c | |||
@@ -33,7 +33,7 @@ | |||
33 | /** | 33 | /** |
34 | * How long until we give up on transmitting the message? | 34 | * How long until we give up on transmitting the message? |
35 | */ | 35 | */ |
36 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) | 36 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600) |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * How long until we give up on transmitting the message? | 39 | * How long until we give up on transmitting the message? |