Process certificate signing request in the right event loop

Summary:
To ensure that no deadlocks take place, it is important that there are no re-entrant calls from within the callbacks or event handlers.

For the most part, this was already the case. Event and message handlers run critical sections into a Folly event scheduler.

The only exception was the sendExpectResponse used during the certificate exchange. Once the response was received, the non-secure socket was disconnected.
The solution was to put that operation in the Folly event scheduler as it should've been from the beginning.

changelog: Certificate signing request response to be processed on the right event loop.

Reviewed By: fabiomassimo

Differential Revision: D35548148

fbshipit-source-id: cea2476ad66137f376acda66cdbc27801c0c47e1
This commit is contained in:
Lorenzo Blasa
2022-04-12 02:30:02 -07:00
committed by Facebook GitHub Bot
parent 30a1d09a83
commit 2bafe32f2a
2 changed files with 84 additions and 66 deletions

View File

@@ -82,7 +82,11 @@ class FlipperConnectionManagerImpl : public FlipperConnectionManager {
bool connectAndExchangeCertificate();
bool connectSecurely();
bool isCertificateExchangeNeeded();
void requestSignedCertFromFlipper();
void requestSignedCertificate();
void processSignedCertificateResponse(
std::shared_ptr<FlipperStep> gettingCertificateStep,
std::string response,
bool isError);
bool isRunningInOwnThread();
void reevaluateSocketProvider();
std::string getDeviceId();