added new test: has timing issue, still fails
[oweals/gnunet.git] / src / ats / gnunet-service-ats-solver_proportional.c
index 31c4ca5e053653a48fd8a39d5529498f3c8c5a24..95fd7be565aecbe5e9a383feee57d490624a5f5a 100644 (file)
@@ -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);