engine->get_netzone_root()->set_network_model(net_model);
simgrid::s4u::Link::on_communication_state_change_cb(NetworkIBModel::IB_action_state_changed_callback);
- simgrid::kernel::activity::CommImpl::on_start.connect(NetworkIBModel::IB_comm_start_callback);
+ simgrid::s4u::Comm::on_start_cb(NetworkIBModel::IB_comm_start_callback);
simgrid::s4u::Host::on_creation_cb(NetworkIBModel::IB_create_host_callback);
simgrid::config::set_default<double>("network/weight-S", 8775);
});
ibModel->active_comms.erase(&action);
}
-void NetworkIBModel::IB_comm_start_callback(const activity::CommImpl& comm)
+void NetworkIBModel::IB_comm_start_callback(const s4u::Comm& comm)
{
- auto* action = static_cast<NetworkAction*>(comm.model_action_);
+ auto* action = static_cast<NetworkAction*>(static_cast<activity::CommImpl*>(comm.get_impl())->model_action_);
auto* ibModel = static_cast<NetworkIBModel*>(action->get_model());
auto* act_src = &ibModel->active_nodes.at(action->get_src().get_name());
auto* act_dst = &ibModel->active_nodes.at(action->get_dst().get_name());
static void IB_create_host_callback(s4u::Host const& host);
static void IB_action_state_changed_callback(NetworkAction& action, Action::State /*previous*/);
- static void IB_comm_start_callback(const activity::CommImpl& comm);
+ static void IB_comm_start_callback(const s4u::Comm& comm);
};
} // namespace simgrid::kernel::resource
#endif
});
// FIXME I think that this fires at the same time for all hosts, so when the src sends something,
// the dst will be notified even though it didn't even arrive at the recv yet
- kernel::activity::CommImpl::on_start.connect([this](const kernel::activity::CommImpl& comm) {
- const auto* act = static_cast<kernel::resource::NetworkAction*>(comm.model_action_);
- if ((get_host() == &act->get_src() || get_host() == &act->get_dst()) && iteration_running) {
+ simgrid::s4u::Comm::on_start_cb([this](const s4u::Comm& comm) {
+ if ((get_host() == comm.get_sender()->get_host() || get_host() == comm.get_receiver()->get_host()) &&
+ iteration_running) {
post_task();
}
});