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: