From c8eda79fb2c401e1e01bc3aabcfaeca161241dce Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Thu, 15 Oct 2020 11:33:48 -0700 Subject: [PATCH] mobility: (fixes #276) Make EnableAsciiAll connect in failsafe way --- src/mobility/helper/mobility-helper.cc | 4 ++-- src/mobility/helper/mobility-helper.h | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/mobility/helper/mobility-helper.cc b/src/mobility/helper/mobility-helper.cc index 9faca446f..aec391cce 100644 --- a/src/mobility/helper/mobility-helper.cc +++ b/src/mobility/helper/mobility-helper.cc @@ -236,8 +236,8 @@ MobilityHelper::EnableAscii (Ptr stream, uint32_t nodeid) { std::ostringstream oss; oss << "/NodeList/" << nodeid << "/$ns3::MobilityModel/CourseChange"; - Config::ConnectWithoutContext (oss.str (), - MakeBoundCallback (&MobilityHelper::CourseChanged, stream)); + Config::ConnectWithoutContextFailSafe (oss.str (), + MakeBoundCallback (&MobilityHelper::CourseChanged, stream)); } void MobilityHelper::EnableAscii (Ptr stream, NodeContainer n) diff --git a/src/mobility/helper/mobility-helper.h b/src/mobility/helper/mobility-helper.h index 63693921f..0ea23a9f3 100644 --- a/src/mobility/helper/mobility-helper.h +++ b/src/mobility/helper/mobility-helper.h @@ -224,26 +224,29 @@ public: * \param stream an output stream wrapper * \param nodeid the id of the node to generate ascii output for. * - * Enable ascii output on the mobility model associated to the - * specified nodeid and dump that to the specified stdc++ output - * stream. + * Enable ascii output to record course changes from the mobility model + * associated with the specified nodeid and dump that to the specified output + * stream. If the Node does not have a MobilityModel aggregated, + * this method will not produce any output. */ static void EnableAscii (Ptr stream, uint32_t nodeid); /** * \param stream an output stream wrapper * \param n node container * - * Enable ascii output on the mobility model associated each of - * the nodes in the input container and dump that to the - * specified stdc++ output stream. + * Enable ascii output to record course changes from the mobility models + * associated to the the nodes in the input container and dump that to the + * specified output stream. Nodes that do not have a MobilityModel + * aggregated will not result in any output. */ static void EnableAscii (Ptr stream, NodeContainer n); /** * \param stream an output stream wrapper * - * Enable ascii output on the mobility model associated - * every node in the system and dump that to the specified - * stdc++ output stream. + * Enable ascii output to record course changes from the mobility models + * associated to every node in the system and dump that to the specified + * output stream. Nodes that do not have a MobilityModel aggregated + * will not result in any output. */ static void EnableAsciiAll (Ptr stream); /**