diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-03-24 15:06:30 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-03-24 15:06:30 +0000 |
commit | 5129c547b91409174c0d6a0c6f9440ae05a43dba (patch) | |
tree | bf534d4319fff444aa3207c627f1b4e207928915 /src/transport/gnunet-service-transport_neighbours.c | |
parent | 6b9d1e71ad452c1c069a1def8328542215327e3e (diff) | |
download | gnunet-5129c547b91409174c0d6a0c6f9440ae05a43dba.tar.gz gnunet-5129c547b91409174c0d6a0c6f9440ae05a43dba.zip |
checking incoming connections
major fixes:
- do not disconnect neighbor on CONNECT_SENT timeout, but:
destroy address and expect new address from ATS
- fixes related to mantis #3263 when peers reconnect:
when peers receive CONNECT in PS_DISCONNECT, disconnect was completed but
-- no address requested
-- ack timestamp not saved
-- ack state was not set to expect a SESSION_ACK message
-> reconnect failed!
minor change:
- adding a GST_ACK_State enumeration to make code easier understandable
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 154 |
1 files changed, 104 insertions, 50 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 1df47a091..cd1d7aa1f 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -84,6 +84,26 @@ | |||
84 | */ | 84 | */ |
85 | #define UTIL_TRANSMISSION_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | 85 | #define UTIL_TRANSMISSION_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) |
86 | 86 | ||
87 | /** | ||
88 | * State describing which kind a reply this neighbour should send | ||
89 | */ | ||
90 | enum GST_ACK_State | ||
91 | { | ||
92 | /** | ||
93 | * We did not receive a CONNECT message for this neighbour | ||
94 | */ | ||
95 | ACK_UNDEFINED = 0, | ||
96 | |||
97 | /* The neighbour received a CONNECT message and has to send a CONNECT_ACK | ||
98 | * as reply */ | ||
99 | ACK_SEND_CONNECT_ACK = 1, | ||
100 | |||
101 | /* The neighbour sent a CONNECT_ACK message and has to send a SESSION_ACK | ||
102 | * as reply */ | ||
103 | ACK_SEND_SESSION_ACK = 2 | ||
104 | }; | ||
105 | |||
106 | |||
87 | GNUNET_NETWORK_STRUCT_BEGIN | 107 | GNUNET_NETWORK_STRUCT_BEGIN |
88 | 108 | ||
89 | /** | 109 | /** |
@@ -277,7 +297,6 @@ struct NeighbourAddress | |||
277 | uint32_t keep_alive_nonce; | 297 | uint32_t keep_alive_nonce; |
278 | }; | 298 | }; |
279 | 299 | ||
280 | |||
281 | /** | 300 | /** |
282 | * Entry in neighbours. | 301 | * Entry in neighbours. |
283 | */ | 302 | */ |
@@ -383,11 +402,12 @@ struct NeighbourMapEntry | |||
383 | /** | 402 | /** |
384 | * Flag to set if we still need to send a CONNECT_ACK message to the other peer | 403 | * Flag to set if we still need to send a CONNECT_ACK message to the other peer |
385 | * (once we have an address to use and the peer has been allowed by our | 404 | * (once we have an address to use and the peer has been allowed by our |
386 | * blacklist). Set to 1 if we need to send a CONNECT_ACK. Set to 2 if we | 405 | * blacklist). Initially set to #ACK_UNDEFINED. Set to #ACK_SEND_CONNECT_ACK |
387 | * did send a CONNECT_ACK and should go to 'S_CONNECTED' upon receiving | 406 | * if we need to send a CONNECT_ACK. Set to #ACK_SEND_CONNECT_ACK if we did |
388 | * a 'SESSION_ACK' (regardless of what our own state machine might say). | 407 | * send a CONNECT_ACK and should go to 'S_CONNECTED' upon receiving a |
408 | * 'SESSION_ACK' (regardless of what our own state machine might say). | ||
389 | */ | 409 | */ |
390 | int send_connect_ack; | 410 | enum GST_ACK_State ack_state; |
391 | 411 | ||
392 | /** | 412 | /** |
393 | * Tracking utilization of outbound bandwidth | 413 | * Tracking utilization of outbound bandwidth |
@@ -510,6 +530,22 @@ static GNUNET_SCHEDULER_TaskIdentifier util_transmission_tk; | |||
510 | 530 | ||
511 | static struct GNUNET_CONTAINER_MultiPeerMap *registered_quota_notifications; | 531 | static struct GNUNET_CONTAINER_MultiPeerMap *registered_quota_notifications; |
512 | 532 | ||
533 | static char * | ||
534 | print_ack_state (enum GST_ACK_State s) | ||
535 | { | ||
536 | switch (s) { | ||
537 | case ACK_UNDEFINED: | ||
538 | return "UNDEFINED"; | ||
539 | case ACK_SEND_CONNECT_ACK: | ||
540 | return "SEND_CONNECT_ACK"; | ||
541 | case ACK_SEND_SESSION_ACK: | ||
542 | return "SEND_SESSION_ACK"; | ||
543 | default: | ||
544 | GNUNET_break (0); | ||
545 | return "N/A"; | ||
546 | } | ||
547 | } | ||
548 | |||
513 | /** | 549 | /** |
514 | * Lookup a neighbour entry in the neighbours hash map. | 550 | * Lookup a neighbour entry in the neighbours hash map. |
515 | * | 551 | * |
@@ -1701,7 +1737,6 @@ send_session_connect (struct NeighbourAddress *na) | |||
1701 | 1737 | ||
1702 | /* Remove address and request and additional one */ | 1738 | /* Remove address and request and additional one */ |
1703 | unset_primary_address (n); | 1739 | unset_primary_address (n); |
1704 | |||
1705 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_INIT_ATS, | 1740 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_INIT_ATS, |
1706 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | 1741 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); |
1707 | return; | 1742 | return; |
@@ -1937,6 +1972,7 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer) | |||
1937 | GNUNET_i2s (peer)); | 1972 | GNUNET_i2s (peer)); |
1938 | n = GNUNET_new (struct NeighbourMapEntry); | 1973 | n = GNUNET_new (struct NeighbourMapEntry); |
1939 | n->id = *peer; | 1974 | n->id = *peer; |
1975 | n->ack_state = ACK_UNDEFINED; | ||
1940 | n->latency = GNUNET_TIME_UNIT_FOREVER_REL; | 1976 | n->latency = GNUNET_TIME_UNIT_FOREVER_REL; |
1941 | n->last_util_transmission = GNUNET_TIME_absolute_get(); | 1977 | n->last_util_transmission = GNUNET_TIME_absolute_get(); |
1942 | n->util_payload_bytes_recv = 0; | 1978 | n->util_payload_bytes_recv = 0; |
@@ -2180,10 +2216,10 @@ handle_test_blacklist_cont (void *cls, | |||
2180 | goto cleanup; /* nobody left to care about new address */ | 2216 | goto cleanup; /* nobody left to care about new address */ |
2181 | } | 2217 | } |
2182 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2183 | "Received blacklist result for peer `%s' in state %s/%d\n", | 2219 | "Received blacklist result for peer `%s' in state %s/%s\n", |
2184 | GNUNET_i2s (peer), | 2220 | GNUNET_i2s (peer), |
2185 | GNUNET_TRANSPORT_ps2s (n->state), | 2221 | GNUNET_TRANSPORT_ps2s (n->state), |
2186 | n->send_connect_ack); | 2222 | print_ack_state (n->ack_state)); |
2187 | switch (n->state) | 2223 | switch (n->state) |
2188 | { | 2224 | { |
2189 | case GNUNET_TRANSPORT_PS_NOT_CONNECTED: | 2225 | case GNUNET_TRANSPORT_PS_NOT_CONNECTED: |
@@ -2198,9 +2234,9 @@ handle_test_blacklist_cont (void *cls, | |||
2198 | case GNUNET_TRANSPORT_PS_CONNECT_SENT: | 2234 | case GNUNET_TRANSPORT_PS_CONNECT_SENT: |
2199 | /* waiting on CONNECT_ACK, send ACK if one is pending */ | 2235 | /* waiting on CONNECT_ACK, send ACK if one is pending */ |
2200 | if ( (GNUNET_OK == result) && | 2236 | if ( (GNUNET_OK == result) && |
2201 | (1 == n->send_connect_ack) ) | 2237 | (ACK_SEND_CONNECT_ACK == n->ack_state) ) |
2202 | { | 2238 | { |
2203 | n->send_connect_ack = 2; | 2239 | n->ack_state = ACK_SEND_SESSION_ACK; |
2204 | send_session_connect_ack_message (n->primary_address.address, | 2240 | send_session_connect_ack_message (n->primary_address.address, |
2205 | n->primary_address.session, | 2241 | n->primary_address.session, |
2206 | n->connect_ack_timestamp); | 2242 | n->connect_ack_timestamp); |
@@ -2233,8 +2269,8 @@ handle_test_blacklist_cont (void *cls, | |||
2233 | send_session_connect_ack_message (bcc->na.address, | 2269 | send_session_connect_ack_message (bcc->na.address, |
2234 | bcc->na.session, | 2270 | bcc->na.session, |
2235 | n->connect_ack_timestamp); | 2271 | n->connect_ack_timestamp); |
2236 | if (1 == n->send_connect_ack) | 2272 | if (ACK_SEND_CONNECT_ACK == n->ack_state) |
2237 | n->send_connect_ack = 2; | 2273 | n->ack_state = ACK_SEND_SESSION_ACK; |
2238 | } | 2274 | } |
2239 | else | 2275 | else |
2240 | { | 2276 | { |
@@ -2258,9 +2294,9 @@ handle_test_blacklist_cont (void *cls, | |||
2258 | case GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK: | 2294 | case GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK: |
2259 | /* waiting on SESSION_ACK, send ACK if one is pending */ | 2295 | /* waiting on SESSION_ACK, send ACK if one is pending */ |
2260 | if ( (GNUNET_OK == result) && | 2296 | if ( (GNUNET_OK == result) && |
2261 | (1 == n->send_connect_ack) ) | 2297 | (ACK_SEND_CONNECT_ACK == n->ack_state) ) |
2262 | { | 2298 | { |
2263 | n->send_connect_ack = 2; | 2299 | n->ack_state = ACK_SEND_SESSION_ACK; |
2264 | send_session_connect_ack_message (n->primary_address.address, | 2300 | send_session_connect_ack_message (n->primary_address.address, |
2265 | n->primary_address.session, | 2301 | n->primary_address.session, |
2266 | n->connect_ack_timestamp); | 2302 | n->connect_ack_timestamp); |
@@ -2274,9 +2310,9 @@ handle_test_blacklist_cont (void *cls, | |||
2274 | break; | 2310 | break; |
2275 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: | 2311 | case GNUNET_TRANSPORT_PS_RECONNECT_BLACKLIST: |
2276 | if ( (GNUNET_OK == result) && | 2312 | if ( (GNUNET_OK == result) && |
2277 | (1 == n->send_connect_ack) ) | 2313 | (ACK_SEND_CONNECT_ACK == n->ack_state) ) |
2278 | { | 2314 | { |
2279 | n->send_connect_ack = 2; | 2315 | n->ack_state = ACK_SEND_SESSION_ACK; |
2280 | send_session_connect_ack_message (bcc->na.address, | 2316 | send_session_connect_ack_message (bcc->na.address, |
2281 | bcc->na.session, | 2317 | bcc->na.session, |
2282 | n->connect_ack_timestamp); | 2318 | n->connect_ack_timestamp); |
@@ -2289,20 +2325,22 @@ handle_test_blacklist_cont (void *cls, | |||
2289 | } | 2325 | } |
2290 | if (GNUNET_OK == result) | 2326 | if (GNUNET_OK == result) |
2291 | { | 2327 | { |
2292 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_SENT, GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); | 2328 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_SENT, |
2329 | GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); | ||
2293 | send_session_connect (&n->primary_address); | 2330 | send_session_connect (&n->primary_address); |
2294 | } | 2331 | } |
2295 | else | 2332 | else |
2296 | { | 2333 | { |
2297 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_ATS, GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | 2334 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_ATS, |
2335 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | ||
2298 | } | 2336 | } |
2299 | break; | 2337 | break; |
2300 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: | 2338 | case GNUNET_TRANSPORT_PS_RECONNECT_SENT: |
2301 | /* waiting on CONNECT_ACK, don't care about blacklist */ | 2339 | /* waiting on CONNECT_ACK, don't care about blacklist */ |
2302 | if ( (GNUNET_OK == result) && | 2340 | if ( (GNUNET_OK == result) && |
2303 | (1 == n->send_connect_ack) ) | 2341 | (ACK_SEND_CONNECT_ACK == n->ack_state) ) |
2304 | { | 2342 | { |
2305 | n->send_connect_ack = 2; | 2343 | n->ack_state = ACK_SEND_SESSION_ACK; |
2306 | send_session_connect_ack_message (n->primary_address.address, | 2344 | send_session_connect_ack_message (n->primary_address.address, |
2307 | n->primary_address.session, | 2345 | n->primary_address.session, |
2308 | n->connect_ack_timestamp); | 2346 | n->connect_ack_timestamp); |
@@ -2329,9 +2367,9 @@ handle_test_blacklist_cont (void *cls, | |||
2329 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: | 2367 | case GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT: |
2330 | /* waiting on CONNECT_ACK, don't care about blacklist */ | 2368 | /* waiting on CONNECT_ACK, don't care about blacklist */ |
2331 | if ( (GNUNET_OK == result) && | 2369 | if ( (GNUNET_OK == result) && |
2332 | (1 == n->send_connect_ack) ) | 2370 | (ACK_SEND_CONNECT_ACK == n->ack_state) ) |
2333 | { | 2371 | { |
2334 | n->send_connect_ack = 2; | 2372 | n->ack_state = ACK_SEND_SESSION_ACK; |
2335 | send_session_connect_ack_message (n->primary_address.address, | 2373 | send_session_connect_ack_message (n->primary_address.address, |
2336 | n->primary_address.session, | 2374 | n->primary_address.session, |
2337 | n->connect_ack_timestamp); | 2375 | n->connect_ack_timestamp); |
@@ -2417,9 +2455,9 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | |||
2417 | struct NeighbourMapEntry *n; | 2455 | struct NeighbourMapEntry *n; |
2418 | struct GNUNET_TIME_Absolute ts; | 2456 | struct GNUNET_TIME_Absolute ts; |
2419 | 2457 | ||
2420 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2458 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2421 | "Received CONNECT message from peer `%s'\n", | 2459 | "Received CONNECT message from peer `%s' with `%s' %p\n", |
2422 | GNUNET_i2s (peer)); | 2460 | GNUNET_i2s (peer), GST_plugins_a2s (address), session); |
2423 | if (ntohs (message->size) != sizeof (struct SessionConnectMessage)) | 2461 | if (ntohs (message->size) != sizeof (struct SessionConnectMessage)) |
2424 | { | 2462 | { |
2425 | GNUNET_break_op (0); | 2463 | GNUNET_break_op (0); |
@@ -2442,14 +2480,16 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | |||
2442 | n = lookup_neighbour (peer); | 2480 | n = lookup_neighbour (peer); |
2443 | if (NULL == n) | 2481 | if (NULL == n) |
2444 | n = setup_neighbour (peer); | 2482 | n = setup_neighbour (peer); |
2445 | n->send_connect_ack = 1; | 2483 | |
2484 | /* Remember this CONNECT message in neighbour */ | ||
2485 | n->ack_state = ACK_SEND_CONNECT_ACK; | ||
2446 | n->connect_ack_timestamp = ts; | 2486 | n->connect_ack_timestamp = ts; |
2447 | 2487 | ||
2448 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2488 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2449 | "Received SESSION_CONNECT for peer `%s' in state %s/%d\n", | 2489 | "Received SESSION_CONNECT for peer `%s' in state %s/%s\n", |
2450 | GNUNET_i2s (peer), | 2490 | GNUNET_i2s (peer), |
2451 | GNUNET_TRANSPORT_ps2s (n->state), | 2491 | GNUNET_TRANSPORT_ps2s (n->state), |
2452 | n->send_connect_ack); | 2492 | print_ack_state (n->ack_state)); |
2453 | switch (n->state) | 2493 | switch (n->state) |
2454 | { | 2494 | { |
2455 | case GNUNET_TRANSPORT_PS_NOT_CONNECTED: | 2495 | case GNUNET_TRANSPORT_PS_NOT_CONNECTED: |
@@ -2476,7 +2516,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | |||
2476 | tell ATS about it */ | 2516 | tell ATS about it */ |
2477 | GNUNET_assert (NULL != n->primary_address.address); | 2517 | GNUNET_assert (NULL != n->primary_address.address); |
2478 | GNUNET_assert (NULL != n->primary_address.session); | 2518 | GNUNET_assert (NULL != n->primary_address.session); |
2479 | n->send_connect_ack = 0; | 2519 | n->ack_state = ACK_UNDEFINED; |
2480 | send_session_connect_ack_message (n->primary_address.address, | 2520 | send_session_connect_ack_message (n->primary_address.address, |
2481 | n->primary_address.session, ts); | 2521 | n->primary_address.session, ts); |
2482 | check_blacklist (peer, ts, address, session); | 2522 | check_blacklist (peer, ts, address, session); |
@@ -2495,7 +2535,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | |||
2495 | tell ATS about it */ | 2535 | tell ATS about it */ |
2496 | GNUNET_assert (NULL != n->primary_address.address); | 2536 | GNUNET_assert (NULL != n->primary_address.address); |
2497 | GNUNET_assert (NULL != n->primary_address.session); | 2537 | GNUNET_assert (NULL != n->primary_address.session); |
2498 | n->send_connect_ack = 0; | 2538 | n->ack_state = ACK_UNDEFINED; |
2499 | send_session_connect_ack_message (n->primary_address.address, | 2539 | send_session_connect_ack_message (n->primary_address.address, |
2500 | n->primary_address.session, ts); | 2540 | n->primary_address.session, ts); |
2501 | check_blacklist (peer, ts, address, session); | 2541 | check_blacklist (peer, ts, address, session); |
@@ -2504,8 +2544,13 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | |||
2504 | /* get rid of remains without terminating sessions, ready to re-try */ | 2544 | /* get rid of remains without terminating sessions, ready to re-try */ |
2505 | free_neighbour (n, GNUNET_YES); | 2545 | free_neighbour (n, GNUNET_YES); |
2506 | n = setup_neighbour (peer); | 2546 | n = setup_neighbour (peer); |
2507 | set_state (n, GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS); | 2547 | /* Remember the CONNECT timestamp for ACK message */ |
2548 | n->ack_state = ACK_SEND_CONNECT_ACK; | ||
2549 | n->connect_ack_timestamp = ts; | ||
2550 | /* Request an address for the peer */ | ||
2551 | GNUNET_ATS_suggest_address (GST_ats, peer, address_suggest_cont, n); | ||
2508 | GNUNET_ATS_reset_backoff (GST_ats, peer); | 2552 | GNUNET_ATS_reset_backoff (GST_ats, peer); |
2553 | set_state (n, GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS); | ||
2509 | break; | 2554 | break; |
2510 | case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED: | 2555 | case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED: |
2511 | /* should not be possible */ | 2556 | /* should not be possible */ |
@@ -2621,9 +2666,9 @@ switch_address_bl_check_cont (void *cls, | |||
2621 | break; | 2666 | break; |
2622 | case GNUNET_TRANSPORT_PS_CONNECT_SENT: | 2667 | case GNUNET_TRANSPORT_PS_CONNECT_SENT: |
2623 | /* waiting on CONNECT_ACK, send ACK if one is pending */ | 2668 | /* waiting on CONNECT_ACK, send ACK if one is pending */ |
2624 | if (1 == n->send_connect_ack) | 2669 | if (ACK_SEND_CONNECT_ACK == n->ack_state) |
2625 | { | 2670 | { |
2626 | n->send_connect_ack = 2; | 2671 | n->ack_state = ACK_SEND_SESSION_ACK; |
2627 | send_session_connect_ack_message (n->primary_address.address, | 2672 | send_session_connect_ack_message (n->primary_address.address, |
2628 | n->primary_address.session, | 2673 | n->primary_address.session, |
2629 | n->connect_ack_timestamp); | 2674 | n->connect_ack_timestamp); |
@@ -2638,10 +2683,15 @@ switch_address_bl_check_cont (void *cls, | |||
2638 | case GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS: | 2683 | case GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS: |
2639 | set_primary_address (n, blc_ctx->address, blc_ctx->session, | 2684 | set_primary_address (n, blc_ctx->address, blc_ctx->session, |
2640 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); | 2685 | blc_ctx->bandwidth_in, blc_ctx->bandwidth_out, GNUNET_NO); |
2641 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_CONNECT_RECV_BLACKLIST, | 2686 | /* Send an ACK message as a response to the CONNECT msg */ |
2642 | GNUNET_TIME_relative_to_absolute (BLACKLIST_RESPONSE_TIMEOUT)); | 2687 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK, |
2643 | check_blacklist (&n->id, n->connect_ack_timestamp, | 2688 | GNUNET_TIME_relative_to_absolute (SETUP_CONNECTION_TIMEOUT)); |
2644 | blc_ctx->address, blc_ctx->session); | 2689 | send_session_connect_ack_message (n->primary_address.address, |
2690 | n->primary_address.session, | ||
2691 | n->connect_ack_timestamp); | ||
2692 | if (ACK_SEND_CONNECT_ACK == n->ack_state) | ||
2693 | n->ack_state = ACK_SEND_SESSION_ACK; | ||
2694 | |||
2645 | break; | 2695 | break; |
2646 | case GNUNET_TRANSPORT_PS_CONNECT_RECV_BLACKLIST_INBOUND: | 2696 | case GNUNET_TRANSPORT_PS_CONNECT_RECV_BLACKLIST_INBOUND: |
2647 | set_timeout (n, GNUNET_TIME_relative_to_absolute (BLACKLIST_RESPONSE_TIMEOUT)); | 2697 | set_timeout (n, GNUNET_TIME_relative_to_absolute (BLACKLIST_RESPONSE_TIMEOUT)); |
@@ -2822,11 +2872,11 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
2822 | 2872 | ||
2823 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 2873 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
2824 | "ATS tells us to switch to %s address '%s' session %p for " | 2874 | "ATS tells us to switch to %s address '%s' session %p for " |
2825 | "peer `%s' in state %s/%d (quota in/out %u %u )\n", | 2875 | "peer `%s' in state %s/%s (quota in/out %u %u )\n", |
2826 | GNUNET_HELLO_address_check_option (address, | 2876 | GNUNET_HELLO_address_check_option (address, |
2827 | GNUNET_HELLO_ADDRESS_INFO_INBOUND) ? "inbound" : "outbound", | 2877 | GNUNET_HELLO_ADDRESS_INFO_INBOUND) ? "inbound" : "outbound", |
2828 | GST_plugins_a2s (address), session, GNUNET_i2s (peer), | 2878 | GST_plugins_a2s (address), session, GNUNET_i2s (peer), |
2829 | GNUNET_TRANSPORT_ps2s (n->state), n->send_connect_ack, | 2879 | GNUNET_TRANSPORT_ps2s (n->state), print_ack_state (n->ack_state), |
2830 | ntohl (bandwidth_in.value__), ntohl (bandwidth_out.value__)); | 2880 | ntohl (bandwidth_in.value__), ntohl (bandwidth_out.value__)); |
2831 | 2881 | ||
2832 | /* Perform blacklist check */ | 2882 | /* Perform blacklist check */ |
@@ -3044,11 +3094,15 @@ master_task (void *cls, | |||
3044 | GNUNET_i2s (&n->id)); | 3094 | GNUNET_i2s (&n->id)); |
3045 | /* We could not send to this address, delete address and session */ | 3095 | /* We could not send to this address, delete address and session */ |
3046 | if (NULL != n->primary_address.session) | 3096 | if (NULL != n->primary_address.session) |
3047 | GNUNET_ATS_address_destroyed (GST_ats, | 3097 | GNUNET_ATS_address_destroyed (GST_ats, n->primary_address.address, |
3048 | n->primary_address.address, n->primary_address.session); | 3098 | n->primary_address.session); |
3049 | GNUNET_ATS_address_destroyed (GST_ats, | 3099 | GNUNET_ATS_address_destroyed (GST_ats, n->primary_address.address, NULL); |
3050 | n->primary_address.address, NULL); | 3100 | |
3051 | disconnect_neighbour (n); | 3101 | /* Remove address and request and additional one */ |
3102 | GNUNET_break (0); | ||
3103 | unset_primary_address (n); | ||
3104 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_INIT_ATS, | ||
3105 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | ||
3052 | return; | 3106 | return; |
3053 | } | 3107 | } |
3054 | break; | 3108 | break; |
@@ -3233,7 +3287,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | |||
3233 | struct GNUNET_TIME_Absolute ts; | 3287 | struct GNUNET_TIME_Absolute ts; |
3234 | struct NeighbourMapEntry *n; | 3288 | struct NeighbourMapEntry *n; |
3235 | 3289 | ||
3236 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3290 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
3237 | "Received CONNECT_ACK message from peer `%s'\n", | 3291 | "Received CONNECT_ACK message from peer `%s'\n", |
3238 | GNUNET_i2s (peer)); | 3292 | GNUNET_i2s (peer)); |
3239 | 3293 | ||
@@ -3513,7 +3567,7 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, | |||
3513 | { | 3567 | { |
3514 | struct NeighbourMapEntry *n; | 3568 | struct NeighbourMapEntry *n; |
3515 | 3569 | ||
3516 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3570 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
3517 | "Received SESSION_ACK message from peer `%s'\n", | 3571 | "Received SESSION_ACK message from peer `%s'\n", |
3518 | GNUNET_i2s (peer)); | 3572 | GNUNET_i2s (peer)); |
3519 | if (ntohs (message->size) != sizeof (struct GNUNET_MessageHeader)) | 3573 | if (ntohs (message->size) != sizeof (struct GNUNET_MessageHeader)) |
@@ -3534,13 +3588,13 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, | |||
3534 | a CONNECT_ACK. If not, return, otherwise break */ | 3588 | a CONNECT_ACK. If not, return, otherwise break */ |
3535 | if ( ( (GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK != n->state) && | 3589 | if ( ( (GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK != n->state) && |
3536 | (GNUNET_TRANSPORT_PS_CONNECT_SENT != n->state) ) || | 3590 | (GNUNET_TRANSPORT_PS_CONNECT_SENT != n->state) ) || |
3537 | (2 != n->send_connect_ack) ) | 3591 | (ACK_SEND_SESSION_ACK != n->ack_state) ) |
3538 | { | 3592 | { |
3539 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3593 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
3540 | "Received SESSION_ACK message from peer `%s' in state %s/%d\n", | 3594 | "Received SESSION_ACK message from peer `%s' in state %s/%s\n", |
3541 | GNUNET_i2s (peer), | 3595 | GNUNET_i2s (peer), |
3542 | GNUNET_TRANSPORT_ps2s (n->state), | 3596 | GNUNET_TRANSPORT_ps2s (n->state), |
3543 | n->send_connect_ack); | 3597 | print_ack_state (n->ack_state)); |
3544 | GNUNET_STATISTICS_update (GST_stats, | 3598 | GNUNET_STATISTICS_update (GST_stats, |
3545 | gettext_noop ("# unexpected SESSION_ACK messages"), 1, | 3599 | gettext_noop ("# unexpected SESSION_ACK messages"), 1, |
3546 | GNUNET_NO); | 3600 | GNUNET_NO); |