Release client if exists before establishing a connection

Summary:
The problem seems to be exclusive to Android emulators.

Bringing the emulator ON from a warm state brings the app from is previous state before shutting down. At this point there may have been a Flipper connection.

Flipper tries to connect and does so successfully replacing the previously, now dead connection.

The problem is that replacing that connection triggers the reconnect cycle as Flipper thinks the connection is dead and hence the reconnect loop initiates.
Changelog: Release an existing client before attempting a secure connection

Reviewed By: passy

Differential Revision: D34080726

fbshipit-source-id: 8185adb492dd4d9255fcea5874ca2e5b7fee0c84
This commit is contained in:
Lorenzo Blasa
2022-02-08 12:39:27 -08:00
committed by Facebook GitHub Bot
parent 2f678f42d5
commit c793549d84

View File

@@ -239,6 +239,8 @@ bool FlipperConnectionManagerImpl::connectAndExchangeCertificate() {
}
bool FlipperConnectionManagerImpl::connectSecurely() {
client_ = nullptr;
auto port = useLegacySocketProvider ? securePort : altSecurePort;
auto endpoint = FlipperConnectionEndpoint(deviceData_.host, port, true);