Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ns3 does not accept 0 as a port_number so don't let it nicely overleap
[simgrid.git] / src / surf / network_ns3.cpp
index 2861ed3..208bedb 100644 (file)
@@ -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.
@@ -507,8 +507,10 @@ NetworkNS3Action::NetworkNS3Action(Model* model, double totalBytes, s4u::Host* s
   ns3::Simulator::ScheduleNow(&start_flow, sock, addr.c_str(), port_number);
 
   port_number++;
-  if (port_number == UINT16_MAX)
+  if (port_number == UINT16_MAX) {
+    port_number = 1;
     XBT_WARN("Too many connections! Port number is saturated. Trying to use the oldest ports.");
+  }
 
   s4u::Link::on_communicate(*this);
 }