Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Convert enum smpi_process_state to enum class.
[simgrid.git] / src / simix / smx_network.cpp
index 72f03f7..c95d8b3 100644 (file)
@@ -339,19 +339,17 @@ void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_activity_t synchro)
   simgrid::kernel::activity::CommImplPtr comm =
       boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(synchro);
 
+  int res;
+
   if (MC_is_active() || MC_record_replay_is_active()){
-    simcall_comm_test__set__result(simcall, comm->src_proc && comm->dst_proc);
-    if (simcall_comm_test__get__result(simcall)){
+    res = comm->src_proc && comm->dst_proc;
+    if (res)
       synchro->state_ = SIMIX_DONE;
-      synchro->simcalls_.push_back(simcall);
-      SIMIX_comm_finish(synchro);
-    } else {
-      SIMIX_simcall_answer(simcall);
-    }
-    return;
+  } else {
+    res = synchro->state_ != SIMIX_WAITING && synchro->state_ != SIMIX_RUNNING;
   }
 
-  simcall_comm_test__set__result(simcall, (synchro->state_ != SIMIX_WAITING && synchro->state_ != SIMIX_RUNNING));
+  simcall_comm_test__set__result(simcall, res);
   if (simcall_comm_test__get__result(simcall)) {
     synchro->simcalls_.push_back(simcall);
     SIMIX_comm_finish(synchro);
@@ -468,7 +466,7 @@ static inline void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr comm)
               receiver->get_cname(), comm->surfAction_);
 
     /* If a link is failed, detect it immediately */
-    if (comm->surfAction_->get_state() == simgrid::kernel::resource::Action::State::failed) {
+    if (comm->surfAction_->get_state() == simgrid::kernel::resource::Action::State::FAILED) {
       XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->get_cname(),
                 receiver->get_cname());
       comm->state_ = SIMIX_LINK_FAILURE;
@@ -530,7 +528,7 @@ void SIMIX_comm_finish(smx_activity_t synchro)
 
     /* Check out for errors */
 
-    if (simcall->issuer->host->isOff()) {
+    if (simcall->issuer->host->is_off()) {
       simcall->issuer->context->iwannadie = 1;
       SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
     } else {
@@ -618,7 +616,7 @@ void SIMIX_comm_finish(smx_activity_t synchro)
       }
     }
 
-    if (simcall->issuer->host->isOff()) {
+    if (simcall->issuer->host->is_off()) {
       simcall->issuer->context->iwannadie = 1;
     }