Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correctly cancel communications when a link is turned off.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 24 Jun 2019 14:16:15 +0000 (16:16 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 24 Jun 2019 14:22:36 +0000 (16:22 +0200)
Fix https://framagit.org/simgrid/simgrid/issues/26

ChangeLog
src/surf/network_cm02.cpp
src/surf/network_interface.cpp

index 74b14db..d8a7317 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,7 +12,7 @@ General:
 Python:
  - Simgrid can now hopefully be installed with pip.
 
-S4U: 
+S4U:
  - wait_any can now be used for asynchronous executions too.
 
 XBT:
@@ -55,6 +55,7 @@ Fixed bugs (FG=FramaGit; GH=GitHub):
  - FG#20: 'tesh --help' should return 0
  - FG#21: Documentation link on http://simgrid.org/ broken
  - FG#22: Debian installation instruction are broken
+ - FG#26: Turning off a link should raise NetworkFailureException exceptions
  - GH#133: Java: a process can run on a VM even if its host is off
  - GH#320: Stacktrace: Avoid the backtrace variant of Boost.Stacktrace?
  - GH#326: Valgrind-detected error for join() when energy plugin is activated
index bf98103..883578b 100644 (file)
@@ -282,19 +282,7 @@ void NetworkCm02Link::apply_event(kernel::profile::Event* triggered, double valu
     if (value > 0)
       turn_on();
     else {
-      kernel::lmm::Variable* var = nullptr;
-      const kernel::lmm::Element* elem = nullptr;
-      double now               = surf_get_clock();
-
       turn_off();
-      while ((var = get_constraint()->get_variable(&elem))) {
-        Action* action = static_cast<Action*>(var->get_id());
-
-        if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED) {
-          action->set_finish_time(now);
-          action->set_state(Action::State::FAILED);
-        }
-      }
     }
     tmgr_trace_event_unref(&state_event_);
   } else {
index e7d5ad9..54f8229 100644 (file)
@@ -138,6 +138,17 @@ void LinkImpl::turn_off()
   if (is_on()) {
     Resource::turn_off();
     s4u::Link::on_state_change(this->piface_);
+
+    kernel::lmm::Variable* var       = nullptr;
+    const kernel::lmm::Element* elem = nullptr;
+    double now                       = surf_get_clock();
+    while ((var = get_constraint()->get_variable(&elem))) {
+      Action* action = static_cast<Action*>(var->get_id());
+      if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED) {
+        action->set_finish_time(now);
+        action->set_state(Action::State::FAILED);
+      }
+    }
   }
 }