Rework flipper state step for connect
Summary: Create the step as an attempt. Remove conditionally marking it as success or failure as connect will not be done 'synchronously' moving forward. :::notes::: Documentation is for personal use and will be removed next. Reviewed By: passy Differential Revision: D46850048 fbshipit-source-id: d6dce961d5cbd767f428e58850d24a433d50ba14
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1b5c9e627a
commit
80673f7832
@@ -213,18 +213,23 @@ bool FlipperConnectionManagerImpl::connectAndExchangeCertificate() {
|
||||
endpoint, std::move(payload), flipperScheduler_);
|
||||
client_->setEventHandler(ConnectionEvents(implWrapper_));
|
||||
|
||||
auto connectingInsecurely = flipperState_->start("Connect insecurely");
|
||||
connectionIsTrusted_ = false;
|
||||
|
||||
auto step =
|
||||
flipperState_->start("Attempt to connect for certificate exchange");
|
||||
|
||||
step->complete();
|
||||
|
||||
// NON-TLS:
|
||||
// On failure: clear the client.
|
||||
// On success: proceed to request the client certificate.
|
||||
|
||||
// Connect is just handled here, move this elsewhere.
|
||||
if (!client_->connect(this)) {
|
||||
connectingInsecurely->fail("Failed to connect");
|
||||
client_ = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
connectingInsecurely->complete();
|
||||
|
||||
requestSignedCertificate();
|
||||
|
||||
return true;
|
||||
@@ -273,17 +278,23 @@ bool FlipperConnectionManagerImpl::connectSecurely() {
|
||||
this->onMessageReceived(folly::parseJson(msg), std::move(responder));
|
||||
});
|
||||
|
||||
auto connectingSecurely = flipperState_->start("Connect securely");
|
||||
connectionIsTrusted_ = true;
|
||||
|
||||
auto step = flipperState_->start(
|
||||
"Attempt to connect with existing client certificate");
|
||||
|
||||
step->complete();
|
||||
|
||||
// TLS:
|
||||
// On failure: clear the client.
|
||||
// On success: clear number of failed attempts.
|
||||
|
||||
// Connect is just handled here, move this elsewhere.
|
||||
if (!client_->connect(this)) {
|
||||
connectingSecurely->fail("Failed to connect");
|
||||
client_ = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
connectingSecurely->complete();
|
||||
failedConnectionAttempts_ = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user