]> AND Private Git Repository - loba.git/blobdiff - process.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
ajout de 8 fichiers de tests (a mon avis leur duree de vie sera tres courte :-) )
[loba.git] / process.cpp
index e6ae2abcdbb2573950534161d56c338f8d512b5a..04c08c0a57bcb4771475c4f1849997c0b9c3ec22 100644 (file)
@@ -322,9 +322,14 @@ void process::data_send(neighbor& nb)
 {
     double load_to_send;
     if (opt::bookkeeping) {
 {
     double load_to_send;
     if (opt::bookkeeping) {
-        load_to_send = compute_load_to_send(std::min(real_load, nb.get_debt()));
-        if (load_to_send > 0.0)
-            nb.set_debt(nb.get_debt() - load_to_send);
+        double excess_load = real_load - expected_load;
+        if (excess_load > 0.0) {
+            load_to_send = compute_load_to_send(std::min(excess_load,
+                                                         nb.get_debt()));
+            if (load_to_send > 0.0)
+                nb.set_debt(nb.get_debt() - load_to_send);
+        } else
+            load_to_send = 0.0;
     } else {
         load_to_send = compute_load_to_send(nb.get_to_send());
         if (load_to_send > 0.0)
     } else {
         load_to_send = compute_load_to_send(nb.get_to_send());
         if (load_to_send > 0.0)