diff --git a/src/mtp/model/multithreaded-simulator-impl.cc b/src/mtp/model/multithreaded-simulator-impl.cc index 24b84e221..37a82b8c3 100644 --- a/src/mtp/model/multithreaded-simulator-impl.cc +++ b/src/mtp/model/multithreaded-simulator-impl.cc @@ -138,7 +138,11 @@ MultithreadedSimulatorImpl::ScheduleWithContext(uint32_t context, EventImpl* event) { NS_LOG_FUNCTION(this << context << delay.GetTimeStep() << event); - LogicalProcess* remote = MtpInterface::GetSystem(NodeList::GetNode(context)->GetSystemId()); + if (m_savedNodeList.GetN() <= context) + { + m_savedNodeList = NodeContainer::GetGlobal(); + } + LogicalProcess* remote = MtpInterface::GetSystem(m_savedNodeList.Get(context)->GetSystemId()); MtpInterface::GetSystem()->ScheduleWithContext(remote, context, delay, event); } diff --git a/src/mtp/model/multithreaded-simulator-impl.h b/src/mtp/model/multithreaded-simulator-impl.h index fdc6709bd..67ac7ca08 100644 --- a/src/mtp/model/multithreaded-simulator-impl.h +++ b/src/mtp/model/multithreaded-simulator-impl.h @@ -31,6 +31,7 @@ #include "ns3/nstime.h" #include "ns3/object-factory.h" #include "ns3/simulator-impl.h" +#include "ns3/node-container.h" #include @@ -94,6 +95,7 @@ class MultithreadedSimulatorImpl : public SimulatorImpl Time m_minLookahead; TypeId m_schedulerTypeId; std::list m_destroyEvents; + NodeContainer m_savedNodeList; }; } // namespace ns3