aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-11-07 10:46:52 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-11-07 10:46:52 +0000
commit3a3fcef078d1266488b642a583f98bf6700f027f (patch)
treec31f3a772486b4501877d277a5d9d3dcd3af8df6 /src/transport
parent262182d8d59db116c09ae428332f7e7fcc714267 (diff)
downloadgnunet-3a3fcef078d1266488b642a583f98bf6700f027f.tar.gz
gnunet-3a3fcef078d1266488b642a583f98bf6700f027f.zip
workaround for:
https://gnunet.org/bugs/view.php?id=1882 https://gnunet.org/bugs/view.php?id=1884
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 14987d6de..4f5b8ca39 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -426,12 +426,16 @@ reset_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
426 n->state_reset = GNUNET_SCHEDULER_NO_TASK; 426 n->state_reset = GNUNET_SCHEDULER_NO_TASK;
427 427
428#if DEBUG_TRANSPORT 428#if DEBUG_TRANSPORT
429 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 429#endif
430 "Connection to peer `%s' %s failed in state `%s', resetting connection attempt \n", 430 /* This jut a temporary debug message to check if a the value
431 * SETUP_CONNECTION_TIMEOUT was choosen to small for slow machines
432 */
433 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
434 "Information for developers: Connection to peer `%s' %s failed in state `%s', resetting connection attempt \n",
431 GNUNET_i2s (&n->id), GST_plugins_a2s (n->plugin_name, n->addr, 435 GNUNET_i2s (&n->id), GST_plugins_a2s (n->plugin_name, n->addr,
432 n->addrlen), 436 n->addrlen),
433 print_state (n->state)); 437 print_state (n->state));
434#endif 438
435 GNUNET_STATISTICS_update (GST_stats, 439 GNUNET_STATISTICS_update (GST_stats,
436 gettext_noop 440 gettext_noop
437 ("# failed connection attempts due to timeout"), 1, 441 ("# failed connection attempts due to timeout"), 1,
@@ -478,7 +482,6 @@ change (struct NeighbourMapEntry *n, int state, int line)
478 GNUNET_SCHEDULER_add_delayed (SETUP_CONNECTION_TIMEOUT, &reset_task, 482 GNUNET_SCHEDULER_add_delayed (SETUP_CONNECTION_TIMEOUT, &reset_task,
479 n); 483 n);
480 } 484 }
481
482 break; 485 break;
483 } 486 }
484 break; 487 break;
@@ -1331,6 +1334,7 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
1331 plugin_name, address, address_len, GNUNET_YES, 1334 plugin_name, address, address_len, GNUNET_YES,
1332 &send_connect_continuation, n); 1335 &send_connect_continuation, n);
1333 1336
1337
1334 return GNUNET_NO; 1338 return GNUNET_NO;
1335 } 1339 }
1336 /* We received a CONNECT message and asked ATS for an address */ 1340 /* We received a CONNECT message and asked ATS for an address */
@@ -2013,14 +2017,15 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2013 n = lookup_neighbour (peer); 2017 n = lookup_neighbour (peer);
2014 if (NULL == n) 2018 if (NULL == n)
2015 n = setup_neighbour (peer); 2019 n = setup_neighbour (peer);
2016/* 2020
2017 if (n->state != S_CONNECT_SENT) 2021 if (!is_connecting(n))
2018 { 2022 {
2019 GNUNET_break (0); 2023 GNUNET_STATISTICS_update (GST_stats,
2020 send_disconnect(&n->id, n->plugin_name, n->addr, n->addrlen, n->session); 2024 gettext_noop ("# unexpected CONNECT_ACK messages"), 1,
2025 GNUNET_NO);
2021 return; 2026 return;
2022 } 2027 }
2023*/ 2028
2024 if (NULL != session) 2029 if (NULL != session)
2025 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, 2030 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
2026 "transport-ats", 2031 "transport-ats",
@@ -2133,6 +2138,13 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
2133 if (is_connected (n)) 2138 if (is_connected (n))
2134 return; 2139 return;
2135 2140
2141 if (!is_connecting(n))
2142 {
2143 GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# unexpected ACK messages"), 1,
2144 GNUNET_NO);
2145 return;
2146 }
2147
2136 if (NULL != session) 2148 if (NULL != session)
2137 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, 2149 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
2138 "transport-ats", 2150 "transport-ats",