From c001d59336d59a5cfd3f67b5ddf2aa665144e22d Mon Sep 17 00:00:00 2001 From: ZorazeAli Date: Fri, 17 May 2019 19:56:23 +0200 Subject: [PATCH] core: Enable NS_LOG_WARN in Config::Connect/Disconnect see merge request nsnam/ns-3-dev!62 --- src/core/model/config.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/core/model/config.cc b/src/core/model/config.cc index 25ee39cf1..7efbdf584 100644 --- a/src/core/model/config.cc +++ b/src/core/model/config.cc @@ -653,6 +653,13 @@ ConfigImpl::ConnectWithoutContext (std::string path, const CallbackBase &cb) std::string root, leaf; ParsePath (path, &root, &leaf); MatchContainer container = LookupMatches (root); + if (container.GetN () == 0) + { + std::size_t lastFwdSlash = root.rfind ("/"); + NS_LOG_WARN ("Failed to connect " << leaf + << ", the Requested object name = " << root.substr (lastFwdSlash + 1) + << " does not exits on path " << root.substr (0, lastFwdSlash)); + } container.ConnectWithoutContext (leaf, cb); } void @@ -662,6 +669,13 @@ ConfigImpl::DisconnectWithoutContext (std::string path, const CallbackBase &cb) std::string root, leaf; ParsePath (path, &root, &leaf); MatchContainer container = LookupMatches (root); + if (container.GetN () == 0) + { + std::size_t lastFwdSlash = root.rfind ("/"); + NS_LOG_WARN ("Failed to disconnect " << leaf + << ", the Requested object name = " << root.substr (lastFwdSlash + 1) + << " does not exits on path " << root.substr (0, lastFwdSlash)); + } container.DisconnectWithoutContext (leaf, cb); } void @@ -672,6 +686,13 @@ ConfigImpl::Connect (std::string path, const CallbackBase &cb) std::string root, leaf; ParsePath (path, &root, &leaf); MatchContainer container = LookupMatches (root); + if (container.GetN () == 0) + { + std::size_t lastFwdSlash = root.rfind ("/"); + NS_LOG_WARN ("Failed to connect " << leaf + << ", the Requested object name = " << root.substr (lastFwdSlash + 1) + << " does not exits on path " << root.substr (0, lastFwdSlash)); + } container.Connect (leaf, cb); } void @@ -682,6 +703,13 @@ ConfigImpl::Disconnect (std::string path, const CallbackBase &cb) std::string root, leaf; ParsePath (path, &root, &leaf); MatchContainer container = LookupMatches (root); + if (container.GetN () == 0) + { + std::size_t lastFwdSlash = root.rfind ("/"); + NS_LOG_WARN ("Failed to disconnect " << leaf + << ", the Requested object name = " << root.substr (lastFwdSlash + 1) + << " does not exits on path " << root.substr (0, lastFwdSlash)); + } container.Disconnect (leaf, cb); }