Rename SonarWebSocket
Summary: Part of Sonar -> Flipper rename. It's about time this is renamed from *Websocket as well, since it doesn't use websockets anymore. Reviewed By: passy Differential Revision: D9919695 fbshipit-source-id: 78a63bfb7d5de19c093b7fb775d1426b4fc58f77
This commit is contained in:
committed by
Facebook Github Bot
parent
2a822a1b99
commit
1d2793f701
71
xplat/Flipper/FlipperConnectionManagerImpl.h
Normal file
71
xplat/Flipper/FlipperConnectionManagerImpl.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "FlipperInitConfig.h"
|
||||
#include "FlipperConnectionManager.h"
|
||||
#include "SonarState.h"
|
||||
#include <folly/Executor.h>
|
||||
#include <folly/io/async/EventBase.h>
|
||||
#include <rsocket/RSocket.h>
|
||||
#include <mutex>
|
||||
|
||||
namespace facebook {
|
||||
namespace flipper {
|
||||
|
||||
class ConnectionEvents;
|
||||
class ConnectionContextStore;
|
||||
class Responder;
|
||||
|
||||
class FlipperConnectionManagerImpl : public FlipperConnectionManager {
|
||||
friend ConnectionEvents;
|
||||
friend Responder;
|
||||
|
||||
public:
|
||||
FlipperConnectionManagerImpl(FlipperInitConfig config, std::shared_ptr<SonarState> state, std::shared_ptr<ConnectionContextStore> contextStore);
|
||||
|
||||
~FlipperConnectionManagerImpl();
|
||||
|
||||
void start() override;
|
||||
|
||||
void stop() override;
|
||||
|
||||
bool isOpen() const override;
|
||||
|
||||
void setCallbacks(Callbacks* callbacks) override;
|
||||
|
||||
void sendMessage(const folly::dynamic& message) override;
|
||||
|
||||
void reconnect();
|
||||
|
||||
private:
|
||||
bool isOpen_ = false;
|
||||
Callbacks* callbacks_;
|
||||
DeviceData deviceData_;
|
||||
std::shared_ptr<SonarState> sonarState_;
|
||||
|
||||
folly::EventBase* sonarEventBase_;
|
||||
folly::EventBase* connectionEventBase_;
|
||||
std::unique_ptr<rsocket::RSocketClient> client_;
|
||||
bool connectionIsTrusted_;
|
||||
int failedConnectionAttempts_ = 0;
|
||||
std::shared_ptr<ConnectionContextStore> contextStore_;
|
||||
|
||||
void startSync();
|
||||
void doCertificateExchange();
|
||||
void connectSecurely();
|
||||
bool isCertificateExchangeNeeded();
|
||||
void requestSignedCertFromSonar();
|
||||
bool isRunningInOwnThread();
|
||||
void sendLegacyCertificateRequest(folly::dynamic message);
|
||||
std::string getDeviceId();
|
||||
};
|
||||
|
||||
} // namespace flipper
|
||||
} // namespace facebook
|
||||
Reference in New Issue
Block a user