X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/98bd9e6807124982d6a9c1a189a89cf8f3664227..acb292ef96c6533590b4adcfb7c6187f798f0f39:/src/surf/ns3/ns3_simulator.cpp diff --git a/src/surf/ns3/ns3_simulator.cpp b/src/surf/ns3/ns3_simulator.cpp index 7ba6d97e80..f41d1e8cf0 100644 --- a/src/surf/ns3/ns3_simulator.cpp +++ b/src/surf/ns3/ns3_simulator.cpp @@ -3,14 +3,13 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "src/surf/ns3/ns3_simulator.h" -#include "xbt/dict.h" +#include "src/surf/ns3/ns3_simulator.hpp" #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)