aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-06-27 09:00:12 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-06-27 09:00:12 +0000
commit9b6d7bf19852eb022909faac709b612aa0173e88 (patch)
tree6ceab0dc11c51b1d7d777c5dd56ecbd1608ca25a /src/transport/gnunet-service-transport_neighbours.c
parent2a81b2108659c69f218dcb629dd740e6308aa4e4 (diff)
downloadgnunet-9b6d7bf19852eb022909faac709b612aa0173e88.tar.gz
gnunet-9b6d7bf19852eb022909faac709b612aa0173e88.zip
fixes for neighbor:
- when alternative address is terminated always free address - when primary address is disconnected during switch, go to "RECONNECT_SENT" and not RECONNECT_ATS_INIT
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 6cebb390f..6ec8c9a03 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -3285,12 +3285,12 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
3285 return GNUNET_NO; /* can't affect us */ 3285 return GNUNET_NO; /* can't affect us */
3286 if (session != n->primary_address.session) 3286 if (session != n->primary_address.session)
3287 { 3287 {
3288 /* Free alternative address */
3288 if (session == n->alternative_address.session) 3289 if (session == n->alternative_address.session)
3289 { 3290 {
3290 if ( (GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT == n->state) ) 3291 if ( (GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_CONNECT_SENT == n->state) )
3291 set_state (n, GNUNET_TRANSPORT_PS_CONNECTED); 3292 set_state (n, GNUNET_TRANSPORT_PS_CONNECTED);
3292 else 3293 free_address (&n->alternative_address);
3293 free_address (&n->alternative_address);
3294 } 3294 }
3295 return GNUNET_NO; /* doesn't affect us further */ 3295 return GNUNET_NO; /* doesn't affect us further */
3296 } 3296 }
@@ -3357,15 +3357,26 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
3357 /* primary went down while we were waiting for CONNECT_ACK on secondary; 3357 /* primary went down while we were waiting for CONNECT_ACK on secondary;
3358 secondary as primary */ 3358 secondary as primary */
3359 3359
3360 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
3361 "Connection `%s' %p to peer `%s' was terminated while switching, "
3362 "switching to alternative address `%s' %p\n",
3363 GST_plugins_a2s (n->primary_address.address),
3364 n->primary_address.session,
3365 GNUNET_i2s (peer),
3366 GST_plugins_a2s (n->alternative_address.address),
3367 n->alternative_address.session);
3368
3360 /* Destroy the inbound address since it cannot be used */ 3369 /* Destroy the inbound address since it cannot be used */
3361 if (GNUNET_YES 3370 if (GNUNET_YES
3362 == GNUNET_HELLO_address_check_option (n->primary_address.address, 3371 == GNUNET_HELLO_address_check_option (n->primary_address.address,
3363 GNUNET_HELLO_ADDRESS_INFO_INBOUND)) 3372 GNUNET_HELLO_ADDRESS_INFO_INBOUND))
3364 GNUNET_ATS_address_destroyed (GST_ats, n->primary_address.address, NULL); 3373 GNUNET_ATS_address_destroyed (GST_ats, n->primary_address.address, NULL);
3365 free_address (&n->primary_address); 3374 free_address (&n->primary_address);
3375
3376
3366 n->primary_address = n->alternative_address; 3377 n->primary_address = n->alternative_address;
3367 memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress)); 3378 memset (&n->alternative_address, 0, sizeof (struct NeighbourAddress));
3368 set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_ATS, 3379 set_state_and_timeout (n, GNUNET_TRANSPORT_PS_RECONNECT_SENT,
3369 GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT)); 3380 GNUNET_TIME_relative_to_absolute (FAST_RECONNECT_TIMEOUT));
3370 break; 3381 break;
3371 case GNUNET_TRANSPORT_PS_DISCONNECT: 3382 case GNUNET_TRANSPORT_PS_DISCONNECT: