X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9712e9b69da18f664d51ce81323234f18494fdd3..acb292ef96c6533590b4adcfb7c6187f798f0f39:/src/surf/ns3/ns3_simulator.cpp diff --git a/src/surf/ns3/ns3_simulator.cpp b/src/surf/ns3/ns3_simulator.cpp index 329680848e..f41d1e8cf0 100644 --- a/src/surf/ns3/ns3_simulator.cpp +++ b/src/surf/ns3/ns3_simulator.cpp @@ -4,13 +4,12 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/surf/ns3/ns3_simulator.hpp" -#include "xbt/dict.h" #include "xbt/log.h" #include "xbt/sysdep.h" #include -xbt_dict_t flowFromSock = nullptr; // ns3::sock -> SgFlow +std::map flowFromSock; // ns3::sock -> SgFlow static void receive_callback(ns3::Ptr socket); static void datasent_callback(ns3::Ptr socket, uint32_t dataSent); @@ -26,7 +25,8 @@ SgFlow::SgFlow(uint32_t totalBytes, simgrid::surf::NetworkNS3Action* action) static SgFlow* getFlowFromSocket(ns3::Ptr socket) { - return (SgFlow*)xbt_dict_get_or_null(flowFromSock, transformSocketPtr(socket)); + auto it = flowFromSock.find(transformSocketPtr(socket)); + return (it == flowFromSock.end()) ? nullptr : it->second; } static void receive_callback(ns3::Ptr socket)