Add getStateSummary method for diagnostics

Summary:
Adds a more structured representation of state updates than a multiline string.
Also changes the string form to omit [started] records.

Reviewed By: danielbuechele

Differential Revision: D9315503

fbshipit-source-id: 55b8f9572091fd42fe852c8d26a8f2a53f76c82a
This commit is contained in:
John Knox
2018-08-15 05:06:34 -07:00
committed by Facebook Github Bot
parent e51b8c0742
commit 660da3f80e
10 changed files with 144 additions and 13 deletions

View File

@@ -7,6 +7,7 @@
*/
#include "SonarWebSocketImpl.h"
#include "SonarStep.h"
#include <folly/String.h>
#include <folly/futures/Future.h>
#include <folly/io/async/SSLContext.h>
@@ -224,11 +225,12 @@ void SonarWebSocketImpl::sendMessage(const folly::dynamic& message) {
}
bool SonarWebSocketImpl::isCertificateExchangeNeeded() {
auto step = sonarState_->start("Check required certificates are present");
if (failedConnectionAttempts_ >= 2) {
return true;
}
auto step = sonarState_->start("Check required certificates are present");
std::string caCert = loadStringFromFile(absoluteFilePath(SONAR_CA_FILE_NAME));
std::string clientCert =
loadStringFromFile(absoluteFilePath(CLIENT_CERT_FILE_NAME));