Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Various cleanups.
[simgrid.git] / src / mc / api / RemoteApp.cpp
index b56d54d4725c4d3420ffd42314a9234a59c00f04..00f34be192d89c3e9a43026c69c2396dbc9af250 100644 (file)
@@ -168,10 +168,7 @@ void RemoteApp::get_actors_status(std::map<aid_t, ActorState>& whereto) const
   //                    <----- send ACTORS_STATUS_REPLY
   //                    <----- send `N` `s_mc_message_actors_status_one_t` structs
   //                    <----- send `M` `s_mc_message_simcall_probe_one_t` structs
-  s_mc_message_t msg;
-  memset(&msg, 0, sizeof msg);
-  msg.type = simgrid::mc::MessageType::ACTORS_STATUS;
-  model_checker_->channel().send(msg);
+  model_checker_->channel().send(MessageType::ACTORS_STATUS);
 
   s_mc_message_actors_status_answer_t answer;
   ssize_t received = model_checker_->channel().receive(answer);
@@ -201,7 +198,7 @@ void RemoteApp::get_actors_status(std::map<aid_t, ActorState>& whereto) const
   // of 3 transitions, that is ignored here since that invariant needs to be enforced on the AppSide
   const auto expected_transitions = std::accumulate(
       status.begin(), status.end(), 0, [](int total, const auto& actor) { return total + actor.n_transitions; });
-  xbt_assert(expected_transitions == action_pool.size(),
+  xbt_assert(expected_transitions == static_cast<int>(action_pool.size()),
              "Expected to receive %d transition(s) but was only notified of %lu by the app side", expected_transitions,
              action_pool.size());
 
@@ -215,14 +212,14 @@ void RemoteApp::get_actors_status(std::map<aid_t, ActorState>& whereto) const
                "(currently %d), but only %d transition(s) was/were said to be encoded",
                actor.max_considered, actor.n_transitions);
 
-    std::stringstream stream((*action_pool_iter).buffer.data());
-    auto actor_transitions = std::vector<std::unique_ptr<Transition>>(actor.max_considered);
-
-    for (int times_considered = 0; times_considered < actor.max_considered; times_considered++, action_pool_iter++) {
+    auto actor_transitions = std::vector<std::unique_ptr<Transition>>(actor.n_transitions);
+    for (int times_considered = 0; times_considered < actor.n_transitions; times_considered++, action_pool_iter++) {
+      std::stringstream stream((*action_pool_iter).buffer.data());
       auto transition = std::unique_ptr<Transition>(deserialize_transition(actor.aid, times_considered, stream));
-      actor_transitions.push_back(std::move(transition));
+      actor_transitions[times_considered] = std::move(transition);
     }
 
+    XBT_DEBUG("Received %d transitions for actor %ld", actor.n_transitions, actor.aid);
     whereto.try_emplace(actor.aid, actor.aid, actor.enabled, actor.max_considered, std::move(actor_transitions));
   }
 }