X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/03a16acd38dfaa266986de5d73f4a90c0ddbfeb1..cb0554d856608cef6bf4c6d92f9b26f203cc97a8:/process.cpp?ds=inline diff --git a/process.cpp b/process.cpp index e6ae2ab..04c08c0 100644 --- a/process.cpp +++ b/process.cpp @@ -322,9 +322,14 @@ void process::data_send(neighbor& nb) { 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)