+void process::send1_bookkeeping(neighbor& nb)
+{
+ if (expected_load != prev_load_broadcast)
+ comm.send(nb.get_ctrl_mbox(),
+ new message(message::INFO, expected_load));
+ double load_to_send;
+ double new_debt;
+ double debt_to_send = nb.get_to_send();
+ if (debt_to_send > 0.0) {
+ comm.send(nb.get_ctrl_mbox(),
+ new message(message::CREDIT, debt_to_send));
+ nb.set_to_send(0.0);
+ new_debt = nb.get_debt() + debt_to_send;
+ } else {
+ new_debt = nb.get_debt();
+ }
+ if (real_load <= new_debt) {
+ load_to_send = real_load;
+ nb.set_debt(new_debt - load_to_send);
+ real_load = 0.0;
+ } else {
+ load_to_send = new_debt;
+ nb.set_debt(0.0);
+ real_load -= load_to_send;
+ }
+ if (load_to_send > 0.0)
+ comm.send(nb.get_data_mbox(), new message(message::LOAD, load_to_send));
+}