X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/558cfc9fc06c8d1a7206b5995d3736cc11319529..6050383ef0dc59e1ca54d02bcf6bccb993593add:/src/surf/network_ns3.cpp diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 3064e7dc78..d3f0405fda 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -260,13 +260,10 @@ NetworkNS3Model::~NetworkNS3Model() { Link* NetworkNS3Model::createLink(const char *name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy, xbt_dict_t properties){ - Link* link = new LinkNS3(this, name, properties, bandwidth, latency); - Link::onCreation(link); - return link; + return new LinkNS3(this, name, properties, bandwidth, latency); } -Action *NetworkNS3Model::communicate(NetCard *src, NetCard *dst, - double size, double rate) +Action *NetworkNS3Model::communicate(NetCard *src, NetCard *dst, double size, double rate) { XBT_DEBUG("Communicate from %s to %s", src->name(), dst->name()); NetworkNS3Action *action = new NetworkNS3Action(this, size, 0); @@ -326,7 +323,7 @@ void NetworkNS3Model::updateActionsState(double now, double delta) action->setRemains(action->getCost() - ns3_get_socket_sent(data)); if (TRACE_is_enabled() && - action->getState() == SURF_ACTION_RUNNING){ + action->getState() == Action::State::running){ double data_sent = ns3_get_socket_sent(data); double data_delta_sent = data_sent - action->m_lastSent; @@ -344,7 +341,7 @@ void NetworkNS3Model::updateActionsState(double now, double delta) xbt_dynar_push(socket_to_destroy,&key); XBT_DEBUG("Destroy socket %p of action %p", key, action); action->finish(); - action->setState(SURF_ACTION_DONE); + action->setState(Action::State::done); } } @@ -369,6 +366,8 @@ LinkNS3::LinkNS3(NetworkNS3Model *model, const char *name, xbt_dict_t props, dou { m_bandwidth.peak = bandwidth; m_latency.peak = latency; + + Link::onCreation(this); } LinkNS3::~LinkNS3()