From c54a08bbd4a6fdcebef3c2759eb92dc4ab3deb73 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Thu, 26 Sep 2013 12:47:54 +0000 Subject: [PATCH] disconnect peer if active address is deleted and no alternative can be suggested --- src/ats/gnunet-service-ats-solver_proportional.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ats/gnunet-service-ats-solver_proportional.c b/src/ats/gnunet-service-ats-solver_proportional.c index 31c4ca5e0..95fd7be56 100644 --- a/src/ats/gnunet-service-ats-solver_proportional.c +++ b/src/ats/gnunet-service-ats-solver_proportional.c @@ -1084,6 +1084,12 @@ GAS_proportional_address_delete (void *solver, struct ATS_Address *address, if (GNUNET_SYSERR == addresse_decrement (s, net, GNUNET_NO, GNUNET_YES)) GNUNET_break(0); distribute_bandwidth_in_network (s, net, NULL ); + + if (NULL == GAS_proportional_get_preferred_address (s, &address->peer)) + { + /* No alternative address found, disconnect peer */ + s->bw_changed (s->bw_changed_cls, address); + } } LOG(GNUNET_ERROR_TYPE_DEBUG, "After deleting address now total %u and active %u addresses in network `%s'\n", @@ -1278,10 +1284,7 @@ GAS_proportional_address_change_network (void *solver, GNUNET_ATS_print_network_type (new_network)); /* Find new address to suggest since no bandwidth in network*/ - if (NULL - == (new = - (struct ATS_Address *) GAS_proportional_get_preferred_address (s, - &address->peer))) + if (NULL == (new = (struct ATS_Address *) GAS_proportional_get_preferred_address (s, &address->peer))) { /* No alternative address found, disconnect peer */ s->bw_changed (s->bw_changed_cls, address); -- 2.25.1