From c793549d842ccf93294abdfe01df025c5272ac33 Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Tue, 8 Feb 2022 12:39:27 -0800 Subject: [PATCH] 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 --- xplat/Flipper/FlipperConnectionManagerImpl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xplat/Flipper/FlipperConnectionManagerImpl.cpp b/xplat/Flipper/FlipperConnectionManagerImpl.cpp index f5aa2f5c4..f79b7fe6e 100644 --- a/xplat/Flipper/FlipperConnectionManagerImpl.cpp +++ b/xplat/Flipper/FlipperConnectionManagerImpl.cpp @@ -239,6 +239,8 @@ bool FlipperConnectionManagerImpl::connectAndExchangeCertificate() { } bool FlipperConnectionManagerImpl::connectSecurely() { + client_ = nullptr; + auto port = useLegacySocketProvider ? securePort : altSecurePort; auto endpoint = FlipperConnectionEndpoint(deviceData_.host, port, true);