security: IMPORTANT CHANGE!! Change Validator constructor to accept Face& instead of shared_ptr<Face>
The old API is kept as deprecated, but will be removed as soon as all
known applications are checked and updated to use new API.
Refs: #1481
Change-Id: Iba0f92b3a3cd48235688f52ab89b2d1f0be9124b
diff --git a/src/security/validator-config.cpp b/src/security/validator-config.cpp
index f622ede..77d3354 100644
--- a/src/security/validator-config.cpp
+++ b/src/security/validator-config.cpp
@@ -16,20 +16,29 @@
const shared_ptr<CertificateCache> ValidatorConfig::DEFAULT_CERTIFICATE_CACHE;
-ValidatorConfig::ValidatorConfig(shared_ptr<Face> face,
- shared_ptr<CertificateCache> certificateCache,
+ValidatorConfig::ValidatorConfig(Face& face,
+ const shared_ptr<CertificateCache>& certificateCache,
const int stepLimit)
: Validator(face)
, m_stepLimit(stepLimit)
, m_certificateCache(certificateCache)
{
- if (!static_cast<bool>(face))
- throw Error("Face is not set!");
-
if (!static_cast<bool>(m_certificateCache))
- m_certificateCache = make_shared<CertificateCacheTtl>(m_face->ioService());
+ m_certificateCache = make_shared<CertificateCacheTtl>(m_face.ioService());
}
+ValidatorConfig::ValidatorConfig(const shared_ptr<Face>& face,
+ const shared_ptr<CertificateCache>& certificateCache,
+ const int stepLimit)
+ : Validator(*face)
+ , m_stepLimit(stepLimit)
+ , m_certificateCache(certificateCache)
+{
+ if (!static_cast<bool>(m_certificateCache))
+ m_certificateCache = make_shared<CertificateCacheTtl>(m_face.ioService());
+}
+
+
void
ValidatorConfig::load(const std::string& filename)
{