X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f6de62b5c3b55d3c2ce894afafaff73248347c62..9b18978e815f3ac70a5de640889c27e9c556857a:/src/surf/network_interface.cpp diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index f1403fabe4..d4e4eb0ba4 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -52,6 +52,11 @@ double NetworkModel::next_occurring_event_full(double now) return minRes; } +double NetworkModel::get_bandwidth_constraint(double rate, double bound, double size) +{ + return rate < 0 ? bound : std::min(bound, rate); +} + /************ * Resource * ************/ @@ -61,9 +66,6 @@ LinkImpl::LinkImpl(const std::string& name) : Resource_T(name), piface_(this) if (name != "__loopback__") xbt_assert(not s4u::Link::by_name_or_null(name), "Link '%s' declared several times in the platform.", name.c_str()); - latency_.scale = 1; - bandwidth_.scale = 1; - s4u::Engine::get_instance()->link_register(name, &piface_); XBT_DEBUG("Create link '%s'", name.c_str()); } @@ -132,6 +134,9 @@ void LinkImpl::turn_off() void LinkImpl::seal() { + if (is_sealed()) + return; + xbt_assert(this->get_model(), "Cannot seal Link(%s) without setting the Network model first", this->get_cname()); Resource::seal(); s4u::Link::on_creation(piface_);