Don't log when insecure connection fails
Summary: Context: https://fb.workplace.com/groups/flippersupport/permalink/803808233433170/ A similar change was done earlier with the secure connection route. This does the same for the insecure route. Reviewed By: mweststrate Differential Revision: D21227196 fbshipit-source-id: 844cb674b5b16033977f451bbc3d8bbc69732273
This commit is contained in:
committed by
Facebook GitHub Bot
parent
08e83560e4
commit
eb1981f9f2
@@ -127,7 +127,11 @@ void FlipperConnectionManagerImpl::startSync() {
|
|||||||
: "Establish main connection");
|
: "Establish main connection");
|
||||||
try {
|
try {
|
||||||
if (isClientSetupStep) {
|
if (isClientSetupStep) {
|
||||||
doCertificateExchange();
|
bool success = doCertificateExchange();
|
||||||
|
if (!success) {
|
||||||
|
reconnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!connectSecurely()) {
|
if (!connectSecurely()) {
|
||||||
// The expected code path when flipper desktop is not running.
|
// The expected code path when flipper desktop is not running.
|
||||||
@@ -162,7 +166,7 @@ void FlipperConnectionManagerImpl::startSync() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlipperConnectionManagerImpl::doCertificateExchange() {
|
bool FlipperConnectionManagerImpl::doCertificateExchange() {
|
||||||
rsocket::SetupParameters parameters;
|
rsocket::SetupParameters parameters;
|
||||||
folly::SocketAddress address;
|
folly::SocketAddress address;
|
||||||
|
|
||||||
@@ -173,7 +177,7 @@ void FlipperConnectionManagerImpl::doCertificateExchange() {
|
|||||||
|
|
||||||
auto connectingInsecurely = flipperState_->start("Connect insecurely");
|
auto connectingInsecurely = flipperState_->start("Connect insecurely");
|
||||||
connectionIsTrusted_ = false;
|
connectionIsTrusted_ = false;
|
||||||
client_ =
|
auto newClient =
|
||||||
rsocket::RSocket::createConnectedClient(
|
rsocket::RSocket::createConnectedClient(
|
||||||
std::make_unique<rsocket::TcpConnectionFactory>(
|
std::make_unique<rsocket::TcpConnectionFactory>(
|
||||||
*connectionEventBase_->getEventBase(), std::move(address)),
|
*connectionEventBase_->getEventBase(), std::move(address)),
|
||||||
@@ -182,7 +186,22 @@ void FlipperConnectionManagerImpl::doCertificateExchange() {
|
|||||||
std::chrono::seconds(connectionKeepaliveSeconds), // keepaliveInterval
|
std::chrono::seconds(connectionKeepaliveSeconds), // keepaliveInterval
|
||||||
nullptr, // stats
|
nullptr, // stats
|
||||||
std::make_shared<ConnectionEvents>(this))
|
std::make_shared<ConnectionEvents>(this))
|
||||||
|
.thenError<folly::AsyncSocketException>([](const auto& e) {
|
||||||
|
if (e.getType() == folly::AsyncSocketException::NOT_OPEN ||
|
||||||
|
e.getType() == folly::AsyncSocketException::NETWORK_ERROR) {
|
||||||
|
// This is the state where no Flipper desktop client is connected.
|
||||||
|
// We don't want an exception thrown here.
|
||||||
|
return std::unique_ptr<rsocket::RSocketClient>(nullptr);
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
})
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
|
if (newClient.get() == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
client_ = std::move(newClient);
|
||||||
connectingInsecurely->complete();
|
connectingInsecurely->complete();
|
||||||
|
|
||||||
auto resettingState = flipperState_->start("Reset state");
|
auto resettingState = flipperState_->start("Reset state");
|
||||||
@@ -190,6 +209,7 @@ void FlipperConnectionManagerImpl::doCertificateExchange() {
|
|||||||
resettingState->complete();
|
resettingState->complete();
|
||||||
|
|
||||||
requestSignedCertFromFlipper();
|
requestSignedCertFromFlipper();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FlipperConnectionManagerImpl::connectSecurely() {
|
bool FlipperConnectionManagerImpl::connectSecurely() {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class FlipperConnectionManagerImpl : public FlipperConnectionManager {
|
|||||||
std::shared_ptr<ConnectionContextStore> contextStore_;
|
std::shared_ptr<ConnectionContextStore> contextStore_;
|
||||||
|
|
||||||
void startSync();
|
void startSync();
|
||||||
void doCertificateExchange();
|
bool doCertificateExchange();
|
||||||
bool connectSecurely();
|
bool connectSecurely();
|
||||||
bool isCertificateExchangeNeeded();
|
bool isCertificateExchangeNeeded();
|
||||||
void requestSignedCertFromFlipper();
|
void requestSignedCertFromFlipper();
|
||||||
|
|||||||
Reference in New Issue
Block a user