+ unsigned int size = xbt_dynar_length(p->pending_sends);
+ unsigned int idx;
+ msg_comm_t *comms = xbt_new(msg_comm_t, size);
+
+ for (idx = 0; idx < size; idx++) {
+ comms[idx] = xbt_dynar_get_as(p->pending_sends, idx, msg_comm_t);
+ }
+
+ XBT_DEBUG("Waiting for sends to finish before shutdown...");
+ MSG_comm_waitall(comms, size, PEER_SHUTDOWN_DEADLINE);