Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix a pair of bugs in storageN11
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 2 Sep 2016 17:31:58 +0000 (19:31 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 2 Sep 2016 17:31:58 +0000 (19:31 +0200)
src/surf/storage_n11.cpp

index e23abc2..21fbb42 100644 (file)
@@ -174,17 +174,15 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta)
 
     action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta);
 
 
     action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta);
 
-    if (action->getMaxDuration() != NO_MAX_DURATION)
+    if (action->getMaxDuration() > NO_MAX_DURATION)
       action->updateMaxDuration(delta);
 
     if(action->getRemainsNoUpdate() > 0 && lmm_get_variable_weight(action->getVariable()) > 0 &&
         action->p_storage->usedSize_ == action->p_storage->size_) {
       action->finish();
       action->setState(Action::State::failed);
       action->updateMaxDuration(delta);
 
     if(action->getRemainsNoUpdate() > 0 && lmm_get_variable_weight(action->getVariable()) > 0 &&
         action->p_storage->usedSize_ == action->p_storage->size_) {
       action->finish();
       action->setState(Action::State::failed);
-    } else if ((action->getRemainsNoUpdate() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) {
-      action->finish();
-      action->setState(Action::State::done);
-    } else if ((action->getMaxDuration() != NO_MAX_DURATION) && (action->getMaxDuration() <= 0)) {
+    } else if (((action->getRemainsNoUpdate() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) ||
+               ((action->getMaxDuration() > NO_MAX_DURATION) && (action->getMaxDuration() <= 0))) {
       action->finish();
       action->setState(Action::State::done);
     }
       action->finish();
       action->setState(Action::State::done);
     }