Skip to content

Commit

Permalink
Fix bug where retry of certificate signing is too fast (#970)
Browse files Browse the repository at this point in the history
* Fix bug where retry of certificate signing should be at least 250 seconds but was 250 milliseconds.
* Set CertSigningWaitMinimum to a value of 30.

Signed-off-by: Maaike Zijderveld, iolar <[email protected]>
  • Loading branch information
maaikez authored and hikinggrass committed Feb 17, 2025
1 parent 1fa8fa0 commit 09350d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
{
"type": "Actual",
"mutability": "ReadWrite",
"value": 0
"value": 30
}
],
"description": "Seconds to wait before generating another CSR in case CSMS does not return a signed certificate.",
Expand Down
6 changes: 3 additions & 3 deletions lib/ocpp/v201/functional_blocks/security.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ void Security::handle_sign_certificate_response(CallResult<SignCertificateRespon
this->awaited_certificate_signing_use_enum = std::nullopt;
return;
}
int retry_backoff_milliseconds =
std::max(minimum_cert_signing_wait_time_seconds, 1000 * cert_signing_wait_minimum.value()) *
int retry_backoff_seconds =
std::max(minimum_cert_signing_wait_time_seconds, cert_signing_wait_minimum.value()) *
std::pow(2, this->csr_attempt); // prevent immediate repetition in case of value 0
this->certificate_signed_timer.timeout(
[this]() {
Expand All @@ -246,7 +246,7 @@ void Security::handle_sign_certificate_response(CallResult<SignCertificateRespon
this->awaited_certificate_signing_use_enum.reset();
this->sign_certificate_req(current_awaited_certificate_signing_use_enum);
},
std::chrono::milliseconds(retry_backoff_milliseconds));
std::chrono::seconds(retry_backoff_seconds));
} else {
this->awaited_certificate_signing_use_enum = std::nullopt;
this->csr_attempt = 1;
Expand Down

0 comments on commit 09350d7

Please sign in to comment.