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-regex.cpp b/src/security/validator-regex.cpp
index 48b9145..1eea45e 100644
--- a/src/security/validator-regex.cpp
+++ b/src/security/validator-regex.cpp
@@ -21,18 +21,26 @@
const shared_ptr<CertificateCache> ValidatorRegex::DEFAULT_CERTIFICATE_CACHE;
-ValidatorRegex::ValidatorRegex(shared_ptr<Face> face,
+ValidatorRegex::ValidatorRegex(Face& face,
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());
+}
+
+ValidatorRegex::ValidatorRegex(const shared_ptr<Face>& face,
+ 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