aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-11-09 17:45:19 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-11-09 17:45:19 +0000
commit386e9b7031aae4f9f3bdbb2ca03a0d82a31f45c6 (patch)
treeae1a4f119abf422d6378c2d64f45043b42858122 /src
parent255a8346839fa3931f7c4b305c998b69dd71f334 (diff)
downloadgnunet-386e9b7031aae4f9f3bdbb2ca03a0d82a31f45c6.tar.gz
gnunet-386e9b7031aae4f9f3bdbb2ca03a0d82a31f45c6.zip
bidirectional connects
Diffstat (limited to 'src')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 75a2dbaa4..31dd07791 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1152,7 +1152,6 @@ send_connect_ack_continuation (void *cls,
1152 struct NeighbourMapEntry *n = cls; 1152 struct NeighbourMapEntry *n = cls;
1153 1153
1154 GNUNET_assert (n != NULL); 1154 GNUNET_assert (n != NULL);
1155
1156 if (GNUNET_YES == success) 1155 if (GNUNET_YES == success)
1157 return; /* sending successful */ 1156 return; /* sending successful */
1158 1157
@@ -1231,10 +1230,11 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
1231 /* checks successful and neighbour != NULL */ 1230 /* checks successful and neighbour != NULL */
1232#if DEBUG_TRANSPORT 1231#if DEBUG_TRANSPORT
1233 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1232 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1234 "ATS tells us to switch to address '%s' session %p for %s peer `%s'\n", 1233 "ATS tells us to switch to address '%s' session %p for peer `%s' in state `%s'\n",
1235 GST_plugins_a2s (address), 1234 GST_plugins_a2s (address),
1236 session, (S_CONNECTED == n->state) ? "CONNECTED" : "NOT CONNECTED", 1235 session,
1237 GNUNET_i2s (peer)); 1236 GNUNET_i2s (peer),
1237 print_state(n->state));
1238#endif 1238#endif
1239 if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK) 1239 if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK)
1240 { 1240 {
@@ -1994,10 +1994,11 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
1994 size_t ret; 1994 size_t ret;
1995 1995
1996#if DEBUG_TRANSPORT 1996#if DEBUG_TRANSPORT
1997 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1997 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1998 "Received CONNECT_ACK message from peer `%s'\n", 1998 "Received CONNECT_ACK message from peer `%s'\n",
1999 GNUNET_i2s (peer)); 1999 GNUNET_i2s (peer));
2000#endif 2000#endif
2001
2001 if (ntohs (message->size) != sizeof (struct SessionConnectMessage)) 2002 if (ntohs (message->size) != sizeof (struct SessionConnectMessage))
2002 { 2003 {
2003 GNUNET_break_op (0); 2004 GNUNET_break_op (0);
@@ -2012,13 +2013,22 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2012 GNUNET_break_op (0); 2013 GNUNET_break_op (0);
2013 return; 2014 return;
2014 } 2015 }
2015 if (n->state != S_CONNECT_SENT) 2016
2017 /* Additional check
2018 *
2019 * ((n->state != S_CONNECT_RECV) && (n->address != NULL)):
2020 *
2021 * We also received an CONNECT message, switched from SENDT to RECV and
2022 * ATS already suggested us an address after a successful blacklist check
2023 */
2024 if ((n->state != S_CONNECT_SENT) && ((n->state != S_CONNECT_RECV) && (n->address != NULL)))
2016 { 2025 {
2017 GNUNET_STATISTICS_update (GST_stats, 2026 GNUNET_STATISTICS_update (GST_stats,
2018 gettext_noop ("# unexpected CONNECT_ACK messages"), 1, 2027 gettext_noop ("# unexpected CONNECT_ACK messages"), 1,
2019 GNUNET_NO); 2028 GNUNET_NO);
2020 return; 2029 return;
2021 } 2030 }
2031
2022 if (NULL != session) 2032 if (NULL != session)
2023 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, 2033 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
2024 "transport-ats", 2034 "transport-ats",
@@ -2026,6 +2036,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2026 session, address->transport_name, GNUNET_i2s (peer)); 2036 session, address->transport_name, GNUNET_i2s (peer));
2027 GNUNET_ATS_address_update (GST_ats, address, session, ats, ats_count); 2037 GNUNET_ATS_address_update (GST_ats, address, session, ats, ats_count);
2028 GNUNET_assert (NULL != n->address); 2038 GNUNET_assert (NULL != n->address);
2039
2029 change_state (n, S_CONNECTED); 2040 change_state (n, S_CONNECTED);
2030 GST_validation_set_address_use (&n->id, 2041 GST_validation_set_address_use (&n->id,
2031 n->address, 2042 n->address,