X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/f83d9279cdb888ebd6952af373a35807b7261437..7fda6bebf9fc5cd93a34234737bb57f605e765ed:/process.cpp diff --git a/process.cpp b/process.cpp index db84ff8..27c3a1b 100644 --- a/process.cpp +++ b/process.cpp @@ -395,12 +395,18 @@ void process::handle_message(message* msg, m_host_t from) case message::CTRL: { neighbor* n = rev_neigh[from]; n->set_load(msg->get_amount() + n->get_to_send()); - expected_load += msg->get_credit(); // may be 0.0 if !opt::bookkeeping + if (opt::bookkeeping) { + double credit = msg->get_credit(); + expected_load += credit; + n->set_credit(n->get_credit() + credit); + } break; } case message::DATA: { + neighbor* n = rev_neigh[from]; double ld = msg->get_amount(); received_load += ld; + n->set_credit(n->get_credit() - ld); break; } case message::CTRL_CLOSE: