Extract file system interaction from SonarWebSocketImpl
Summary: SonarWebSocketImpl has got pretty bloated. So I'm extracting all the file interaction out of it into ConnectionContextStore. The purpose of this class is to provide all the context needed to establish a connection. This makes SonarWebSocketImpl more functional and therefore testable. Reviewed By: priteshrnandgaonkar Differential Revision: D9540089 fbshipit-source-id: 0cd1d69f2b11eaf9f569245a2da14f85cc140427
This commit is contained in:
committed by
Facebook Github Bot
parent
a5af72a169
commit
afea2f63ec
@@ -20,6 +20,7 @@ namespace facebook {
|
||||
namespace sonar {
|
||||
|
||||
class ConnectionEvents;
|
||||
class ConnectionContextStore;
|
||||
class Responder;
|
||||
|
||||
class SonarWebSocketImpl : public SonarWebSocket {
|
||||
@@ -27,7 +28,7 @@ class SonarWebSocketImpl : public SonarWebSocket {
|
||||
friend Responder;
|
||||
|
||||
public:
|
||||
SonarWebSocketImpl(SonarInitConfig config, std::shared_ptr<SonarState> state);
|
||||
SonarWebSocketImpl(SonarInitConfig config, std::shared_ptr<SonarState> state, std::shared_ptr<ConnectionContextStore> contextStore);
|
||||
|
||||
~SonarWebSocketImpl();
|
||||
|
||||
@@ -54,16 +55,13 @@ class SonarWebSocketImpl : public SonarWebSocket {
|
||||
std::unique_ptr<rsocket::RSocketClient> client_;
|
||||
bool connectionIsTrusted_;
|
||||
int failedConnectionAttempts_ = 0;
|
||||
std::shared_ptr<ConnectionContextStore> contextStore_;
|
||||
|
||||
void startSync();
|
||||
void doCertificateExchange();
|
||||
void connectSecurely();
|
||||
std::string loadCSRFromFile();
|
||||
std::string loadStringFromFile(std::string fileName);
|
||||
std::string absoluteFilePath(const char* relativeFilePath);
|
||||
bool isCertificateExchangeNeeded();
|
||||
void requestSignedCertFromSonar();
|
||||
bool ensureSonarDirExists();
|
||||
bool isRunningInOwnThread();
|
||||
void sendLegacyCertificateRequest(folly::dynamic message);
|
||||
std::string getDeviceId();
|
||||
|
||||
Reference in New Issue
Block a user