Socket connect no longer synchronous and blocking
Summary: Never really liked this code. Before this change, calls to connect were blocking. Because of this, we had to make use of promises and a bit of really not that good-looking code. So, this change makes connect non-blocking meaning that we make full use of our event handler. These changes contain: - CSR is not getting generated after each failed attempt. - Connect is no longer blocking. - Do not report events via the handler when explicitly disconnecting. Reviewed By: jknoxville Differential Revision: D46853228 fbshipit-source-id: 00e6a9c7c039a756175fe14982959e078d92bacb
This commit is contained in:
committed by
Facebook GitHub Bot
parent
65e515bdaa
commit
e42db220ee
@@ -55,33 +55,35 @@ class FlipperConnectionManagerImpl : public FlipperConnectionManager {
|
||||
|
||||
private:
|
||||
bool isConnected_ = false;
|
||||
bool isStarted_ = false;
|
||||
std::shared_ptr<FlipperCertificateProvider> certProvider_ = nullptr;
|
||||
bool started_ = false;
|
||||
bool isConnectionTrusted_ = false;
|
||||
|
||||
std::shared_ptr<FlipperCertificateProvider> certificateProvider_ = nullptr;
|
||||
|
||||
Callbacks* callbacks_;
|
||||
|
||||
DeviceData deviceData_;
|
||||
std::shared_ptr<FlipperState> flipperState_;
|
||||
|
||||
std::shared_ptr<FlipperState> state_;
|
||||
|
||||
int insecurePort;
|
||||
int securePort;
|
||||
int altInsecurePort;
|
||||
int altSecurePort;
|
||||
|
||||
Scheduler* flipperScheduler_;
|
||||
Scheduler* scheduler_;
|
||||
Scheduler* connectionScheduler_;
|
||||
|
||||
std::unique_ptr<FlipperSocket> client_;
|
||||
|
||||
bool connectionIsTrusted_;
|
||||
bool certificateExchangeCompleted_ = false;
|
||||
std::unique_ptr<FlipperSocket> socket_;
|
||||
|
||||
int failedConnectionAttempts_ = 0;
|
||||
int failedSocketConnectionAttempts = 0;
|
||||
|
||||
std::shared_ptr<ConnectionContextStore> contextStore_;
|
||||
std::shared_ptr<ConnectionContextStore> store_;
|
||||
std::shared_ptr<FlipperConnectionManagerWrapper> implWrapper_;
|
||||
|
||||
void startSync();
|
||||
bool connectAndExchangeCertificate();
|
||||
bool connectSecurely();
|
||||
void connectAndExchangeCertificate();
|
||||
void connectSecurely();
|
||||
void handleSocketEvent(const SocketEvent event);
|
||||
bool isCertificateExchangeNeeded();
|
||||
void requestSignedCertificate();
|
||||
|
||||
Reference in New Issue
Block a user