void LeaderNode::handle_requests() { #ifdef DEBUG printf("LeaderNode entering handle_requests!\n"); #endif while (true) { while (msg_ready() == false) { message_select(); } while (msg_ready() == true) { msg_info = msg_queue.front(); msg_queue.pop_front(); #ifdef DEBUG printf("msg_queue.size: %u\n", msg_queue.size()); #endif switch (msg_info.tag) { case SPAWN_JOB: handle_spawn_job(); break; case SPAWN_CACHE: handle_spawn_cache(); break; case EXIT: handle_exit(); break; case EXIT_ACK: handle_exit_ack(); break; default: printf("===== DEFAULT =====\n"); printf("LeaderNode %d\n", local_rank); print_msg_info(&msg_info); MPI_ASSERT(FAILURE); break; } } } }
int um_consume_buffer(um_parser_t* um_parser, const uint8_t* buf, size_t nbuf, msg_ready_cb* msg_ready, void* context) { while (nbuf > 0) { uint64_t reqid; mc_msg_t* msg; ssize_t consumed = um_consume_one_message(um_parser, buf, nbuf, &reqid, &msg); if (consumed <= 0) { return -1; } FBI_ASSERT(consumed <= nbuf); if (msg != NULL) { msg_ready(context, reqid, msg); buf += consumed; nbuf -= consumed; } else { FBI_ASSERT(consumed == nbuf); break; } } return 0; }