security: Simplify (unify) implementation of v2::KeyChain::selfSign
Change-Id: Iec052adfe76fbaad6862caa4a61091aa5f6b10ac
Refs: #2926
diff --git a/src/security/pib/pib.cpp b/src/security/pib/pib.cpp
index 6c5f316..68b9add 100644
--- a/src/security/pib/pib.cpp
+++ b/src/security/pib/pib.cpp
@@ -21,11 +21,14 @@
#include "pib.hpp"
#include "pib-impl.hpp"
+#include "util/logger.hpp"
namespace ndn {
namespace security {
namespace pib {
+NDN_LOG_INIT(ndn.security.pib.Pib);
+
Pib::Pib(const std::string& scheme, const std::string& location, shared_ptr<PibImpl> impl)
: m_scheme(scheme)
, m_location(location)
@@ -86,8 +89,9 @@
{
BOOST_ASSERT(m_identities.isConsistent());
- if (m_isDefaultIdentityLoaded && m_defaultIdentity.getName() == identity)
+ if (m_isDefaultIdentityLoaded && m_defaultIdentity.getName() == identity) {
m_isDefaultIdentityLoaded = false;
+ }
m_identities.remove(identity);
}
@@ -115,6 +119,7 @@
m_defaultIdentity = m_identities.add(identityName);
m_isDefaultIdentityLoaded = true;
+ NDN_LOG_DEBUG("Default identity is set to " << identityName);
m_impl->setDefaultIdentity(identityName);
return m_defaultIdentity;
@@ -128,6 +133,7 @@
if (!m_isDefaultIdentityLoaded) {
m_defaultIdentity = m_identities.get(m_impl->getDefaultIdentity());
m_isDefaultIdentityLoaded = true;
+ NDN_LOG_DEBUG("Default identity is " << m_defaultIdentity.getName());
}
BOOST_ASSERT(m_impl->getDefaultIdentity() == m_defaultIdentity.getName());