Speed up re-connect after re-opening app
Summary: The problem is that whenever an app is shutdown, and then reopened, the flipper dir gets reset when getting the CSR for connecting to flipper. This causes the first connection attempt to fail always, and it goes through the whole cert exchange, taking longer than necessary. Fixes it by loading the csr from disk if it's not loaded yet, without blowing away the whole certs state. A side effect of this would be that as long as some file exists where the csr lives, flipper state would never get reset, so it wouldn't be able to fix itself automatically anymore. To keep that working, I've made `resetFlipperDir()` public and am calling it explicitly when starting certificate exchange. This should ensure that we still reset when we need to, but not unnecessarily. The reason it went wrong is that getCSR used to be called only at cert exchange, when resetting and generating a new one was always desirable. However, when we shipped the fix for changeable android serials, it started to be used as a normal getter. Reviewed By: timur-valiev Differential Revision: D18834806 fbshipit-source-id: 56ca7e03e1aa9011f836bc9c021cf3048f7dc1e4
This commit is contained in:
committed by
Facebook Github Bot
parent
cde949e3a1
commit
c2370f7faf
@@ -187,6 +187,10 @@ void FlipperConnectionManagerImpl::doCertificateExchange() {
|
||||
.get();
|
||||
connectingInsecurely->complete();
|
||||
|
||||
auto resettingState = flipperState_->start("Reset state");
|
||||
contextStore_->resetState();
|
||||
resettingState->complete();
|
||||
|
||||
requestSignedCertFromFlipper();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user