+static void do_command(int rank, void*c) {
+ xbt_ex_t e;
+ xbt_workload_elm_t cmd = *(xbt_workload_elm_t*)c;
+ xbt_workload_data_chunk_t chunk;
+
+ if (cmd->action == XBT_WORKLOAD_SEND) {
+ chunk = xbt_workload_data_chunk_new((int)(cmd->d_arg));
+ INFO2("Send %.f bytes to %s",cmd->d_arg,cmd->str_arg);
+ gras_msg_send(get_peer_sock(cmd->str_arg),"chunk",&chunk);
+
+ } else if (cmd->action == XBT_WORKLOAD_RECV) {
+ INFO2("Recv %.f bytes from %s",cmd->d_arg,cmd->str_arg);
+ TRY {
+ gras_msg_wait(1000000,"chunk",NULL,&chunk);
+ } CATCH(e) {
+ RETHROW2("Exception while waiting for %f bytes from %s: %s",
+ cmd->d_arg,cmd->str_arg);
+ }
+ xbt_workload_data_chunk_free(chunk);
+
+ } else {
+ xbt_die(bprintf("unknown command: %s",xbt_workload_elm_to_string(cmd)));
+ }
+}