X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5028a3598ee0b23b9e9b52e28a91184d8f9fa551..0d3fb525534744cb1a0f7e0b664dbb3c2791e9cc:/src/surf/network_ns3.cpp diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index f82de064a6..c5e05259f3 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -327,7 +327,7 @@ void NetworkNS3Model::update_actions_state(double now, double delta) ns3_socket = elm.first; SgFlow* sgFlow = elm.second; NetworkNS3Action * action = sgFlow->action_; - XBT_DEBUG("Processing socket %p (action %p)",sgFlow,action); + XBT_DEBUG("Processing flow %p (socket %s, action %p)", sgFlow, ns3_socket.c_str(), action); // Because NS3 stops as soon as a flow is finished, the other flows that ends at the same time may remains in an // inconsistent state (i.e. remains_ == 0 but finished_ == false). // However, SimGrid considers sometimes that an action with remains_ == 0 is finished. @@ -460,13 +460,12 @@ void LinkNS3::set_latency_profile(profile::Profile*) NetworkNS3Action::NetworkNS3Action(Model* model, double totalBytes, s4u::Host* src, s4u::Host* dst) : NetworkAction(model, *src, *dst, totalBytes, false) { - // ns-3 fails when src = dst, so avoid the problem by considering that communications are infinitely fast on the // loopback that does not exists if (src == dst) { static bool warned = false; if (not warned) { - XBT_WARN("Sending from an host %s to itself is not supported by ns-3. Every such communication finishes " + XBT_WARN("Sending from a host %s to itself is not supported by ns-3. Every such communication finishes " "immediately upon startup.", src->get_cname()); warned = true; @@ -483,7 +482,7 @@ NetworkNS3Action::NetworkNS3Action(Model* model, double totalBytes, s4u::Host* s } } - static int port_number = 1025; // Port number is limited from 1025 to 65 000 + static uint16_t port_number = 1; ns3::Ptr src_node = src->get_netpoint()->extension()->ns3_node_; ns3::Ptr dst_node = dst->get_netpoint()->extension()->ns3_node_; @@ -504,14 +503,11 @@ NetworkNS3Action::NetworkNS3Action(Model* model, double totalBytes, s4u::Host* s sink_from_sock.insert({transform_socket_ptr(sock), apps}); sock->Bind(ns3::InetSocketAddress(port_number)); - ns3::Simulator::ScheduleNow(&start_flow, sock, addr.c_str(), port_number); - port_number++; - if(port_number > 65000){ - port_number = 1025; + port_number = 1 + (port_number % UINT16_MAX); + if (port_number == 1) XBT_WARN("Too many connections! Port number is saturated. Trying to use the oldest ports."); - } s4u::Link::on_communicate(*this); }