+ if (surf_action_->get_state() == resource::Action::State::FAILED) {
+ if (disk_ && not disk_->is_on())
+ set_state(State::FAILED);
+ else
+ set_state(State::CANCELED);
+ } else if (timeout_detector_ && timeout_detector_->get_state() == resource::Action::State::FINISHED) {
+ if (surf_action_->get_remains() > 0.0) {
+ surf_action_->set_state(resource::Action::State::FAILED);
+ set_state(State::TIMEOUT);
+ } else {
+ set_state(State::DONE);
+ }
+ } else {
+ set_state(State::DONE);
+ }
+
+ clean_action();
+ if (timeout_detector_) {
+ timeout_detector_->unref();
+ timeout_detector_ = nullptr;
+ }
+
+ /* Answer all simcalls associated with the synchro */
+ finish();
+}
+void IoImpl::set_exception(actor::ActorImpl* issuer)
+{
+ switch (get_state()) {
+ case State::FAILED:
+ issuer->set_wannadie();
+ static_cast<s4u::Io*>(get_iface())->complete(s4u::Activity::State::FAILED);
+ issuer->exception_ = std::make_exception_ptr(StorageFailureException(XBT_THROW_POINT, "Storage failed"));
+ break;
+ case State::CANCELED:
+ issuer->exception_ = std::make_exception_ptr(CancelException(XBT_THROW_POINT, "I/O Canceled"));