remove default constructor of CaState
Change-Id: I8d7dbad11299e740bbb94b6f8ebc1bea878e510f
diff --git a/src/ca-module.cpp b/src/ca-module.cpp
index 0c40040..493a959 100644
--- a/src/ca-module.cpp
+++ b/src/ca-module.cpp
@@ -337,7 +337,7 @@
{
// get certificate request state
auto requestState = getCertificateRequest(request);
- if (requestState== nullptr) {
+ if (requestState == nullptr) {
NDN_LOG_ERROR("No certificate request state can be found.");
m_face.put(generateErrorDataPacket(request.getName(), ErrorCode::INVALID_PARAMETER,
"No certificate request state can be found."));
diff --git a/src/detail/ca-memory.cpp b/src/detail/ca-memory.cpp
index e6ba9c0..893801e 100644
--- a/src/detail/ca-memory.cpp
+++ b/src/detail/ca-memory.cpp
@@ -49,7 +49,7 @@
{
auto search = m_requests.find(request.m_requestId);
if (search == m_requests.end()) {
- m_requests[request.m_requestId] = request;
+ m_requests.insert(std::make_pair(request.m_requestId, request));
}
else {
NDN_THROW(std::runtime_error("Request " + toHex(request.m_requestId.data(), request.m_requestId.size()) + " already exists"));
@@ -59,8 +59,13 @@
void
CaMemory::updateRequest(const CaState& request)
{
- m_requests[request.m_requestId].m_status = request.m_status;
- m_requests[request.m_requestId].m_challengeState = request.m_challengeState;
+ auto search = m_requests.find(request.m_requestId);
+ if (search == m_requests.end()) {
+ m_requests.insert(std::make_pair(request.m_requestId, request));
+ }
+ else {
+ search->second = request;
+ }
}
void
diff --git a/src/detail/ca-state.hpp b/src/detail/ca-state.hpp
index 994d185..5f96fb0 100644
--- a/src/detail/ca-state.hpp
+++ b/src/detail/ca-state.hpp
@@ -83,7 +83,6 @@
class CaState
{
public:
- CaState() = default;
/**
* @brief Used to instantiate a CaState when challenge is not started.
*/