X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/4e922bca67d7cf4bc30a878cd7cd46d39fbe1573..3a1185f2c9e5bc9c13c7d94c3c03cd45fb02f13e:/loba_simple.cpp?ds=sidebyside

diff --git a/loba_simple.cpp b/loba_simple.cpp
index 2d4103c..5a0a153 100644
--- a/loba_simple.cpp
+++ b/loba_simple.cpp
@@ -27,10 +27,11 @@ void loba_simple::load_balance()
             max = l;
         }
     }
-    if (imin != -1) {
-        // found someone
-        double balance = (get_load() - max) / 2;
-        DEBUG6("%d:%g %d:%g %g %g", imin, min, imax, max, get_load(), balance);
+    if (imin != -1) {           // found someone
+        double balance = std::min((get_load() - min) / 2.0,
+                                  (get_load() - max));
+        XBT_DEBUG("%d:%g %d:%g %g %g",
+                  imin, min, imax, max, get_load(), balance);
         send(pneigh[imin], balance);
     }
 }