Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove dead code after returrn statement.
[simgrid.git] / src / s4u / s4u_Comm.cpp
index 7eb4685..8f0fc88 100644 (file)
@@ -6,6 +6,7 @@
 #include "src/msg/msg_private.hpp"
 #include "xbt/log.h"
 
+#include "simgrid/Exception.hpp"
 #include "simgrid/s4u/Comm.hpp"
 #include "simgrid/s4u/Mailbox.hpp"
 
@@ -145,7 +146,7 @@ Comm* Comm::wait_for(double timeout)
 {
   switch (state_) {
     case State::FINISHED:
-      return this;
+      break;
 
     case State::INITED: // It's not started yet. Do it in one simcall
       if (src_buff_ != nullptr) {
@@ -159,16 +160,17 @@ Comm* Comm::wait_for(double timeout)
                           user_data_, timeout, rate_);
       }
       state_ = State::FINISHED;
-      return this;
+      break;
 
     case State::STARTED:
       simcall_comm_wait(pimpl_, timeout);
       on_completion(Actor::self());
       state_ = State::FINISHED;
-      return this;
+      break;
 
     case State::CANCELED:
-      return this;
+      throw CancelException(XBT_THROW_POINT, "Communication canceled");
+
     default:
       THROW_IMPOSSIBLE;
   }