+ XBT_DEBUG("CommImpl::finish() comm %p, state %s, src_proc %p, dst_proc %p, detached: %d", this, get_state_str(),
+ src_actor_.get(), dst_actor_.get(), detached_);
+
+ if (get_iface()) {
+ const auto& piface = static_cast<const s4u::Comm&>(*get_iface());
+ set_iface(nullptr); // reset iface to protect against multiple trigger of the on_completion signals
+ piface.fire_on_completion_for_real();
+ piface.fire_on_this_completion_for_real();
+ }
+
+ /* Update synchro state */
+ if (src_timeout_ && src_timeout_->get_state() == resource::Action::State::FINISHED)
+ set_state(State::SRC_TIMEOUT);
+ else if (dst_timeout_ && dst_timeout_->get_state() == resource::Action::State::FINISHED)
+ set_state(State::DST_TIMEOUT);
+ else if ((from_ && not from_->is_on()) ||
+ (src_timeout_ && src_timeout_->get_state() == resource::Action::State::FAILED))
+ set_state(State::SRC_HOST_FAILURE);
+ else if ((to_ && not to_->is_on()) || (dst_timeout_ && dst_timeout_->get_state() == resource::Action::State::FAILED))
+ set_state(State::DST_HOST_FAILURE);
+ else if (model_action_ && model_action_->get_state() == resource::Action::State::FAILED) {
+ set_state(State::LINK_FAILURE);
+ } else if (get_state() == State::RUNNING) {
+ xbt_assert(from_ && from_->is_on());
+ xbt_assert(to_ && to_->is_on());
+ set_state(State::DONE);
+ }
+ src_timeout_ = nullptr;
+ dst_timeout_ = nullptr;
+
+ /* destroy the model actions associated with the communication activity */
+ clean_action();
+