- m_task_t task;
- while ((task = comm.recv())) {
- message *msg = (message *)MSG_task_get_data(task);
- DEBUG3("Received load: %g, info: %g from %s",
- msg->transfer, msg->measure,
- MSG_host_get_name(MSG_task_get_source(task)));
- load += msg->transfer;
- // fixme: what is xxx ???
- // neigh[xxx].setLoad(msg->measure);
+ message* msg;
+ m_host_t from;
+ while (comm.recv(msg, from)) {
+ switch (msg->get_type()) {
+ case message::INFO:
+ // fixme: update neighbor
+ break;
+ case message::CREDIT:
+ expected_load += msg->get_amount();
+ break;
+ case message::LOAD:
+ load += msg->get_amount();
+ break;
+ }
+ delete msg;