Skip to content

Commit

Permalink
controller: use a single keychain
Browse files Browse the repository at this point in the history
Fixes crash due to inconsistent keychains between contact-manager,
controller and the face.

Change-Id: I8adcd0767e36d7447468899eabd0debcf4185380
  • Loading branch information
pulsejet authored and Pesa committed Jan 11, 2021
1 parent b3d03b9 commit 074e38d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/contact-manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ using ndn::security::Certificate;


ContactManager::ContactManager(Face& face,
ndn::KeyChain& keyChain,
QObject* parent)
: QObject(parent)
, m_face(face)
, m_keyChain(keyChain)
{
initializeSecurity();
}
Expand Down
4 changes: 2 additions & 2 deletions src/contact-manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ContactManager : public QObject
Q_OBJECT

public:
ContactManager(ndn::Face& m_face, QObject* parent = 0);
ContactManager(ndn::Face& face, ndn::KeyChain& keyChain, QObject* parent = 0);

~ContactManager();

Expand Down Expand Up @@ -275,7 +275,7 @@ public slots:
shared_ptr<ContactStorage> m_contactStorage;
shared_ptr<ndn::security::ValidatorConfig> m_validator;
ndn::Face& m_face;
ndn::KeyChain m_keyChain;
ndn::KeyChain& m_keyChain;
Name m_identity;
ContactList m_contactList;

Expand Down
3 changes: 2 additions & 1 deletion src/controller-backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ static const int CONNECTION_RETRY_TIMER = 3;
ControllerBackend::ControllerBackend(QObject* parent)
: QThread(parent)
, m_shouldResume(false)
, m_contactManager(m_face)
, m_face(nullptr, m_keyChain)
, m_contactManager(m_face, m_keyChain)
{
// connection to contact manager
connect(this, SIGNAL(identityUpdated(const QString&)),
Expand Down
6 changes: 3 additions & 3 deletions src/controller-backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,17 @@ private slots:
private:
bool m_isNfdConnected;
bool m_shouldResume;
ndn::Face m_face;

Name m_identity; //TODO: set/get

Name m_localPrefix;

ndn::KeyChain m_keyChain;
ndn::Face m_face;

// Contact Manager
ContactManager m_contactManager;

// Security related;
ndn::KeyChain m_keyChain;
shared_ptr<ndn::security::Validator> m_validator;
ndn::security::ValidatorNull m_nullValidator;

Expand Down

0 comments on commit 074e38d

Please sign in to comment.