Clear handlers on disconnect

Summary:
A few changes that should make our connect/disconnect more robust:

* Certificate provider handler should be set directly to and managed by the policy.
* Instantiate the socket once, synchronously on the connect method. Explicit deallocation once, synchronously on the disconnect method.
* Clear handlers on disconnect after clearing the delegate.
* Wait for the operation queue to drain before returning.

Reviewed By: passy

Differential Revision: D42664724

fbshipit-source-id: bd482acbb64a9bc9e36fb3418d4c81afa2109305
This commit is contained in:
Lorenzo Blasa
2023-01-23 03:45:59 -08:00
committed by Facebook GitHub Bot
parent b31f8c8755
commit 764e94503e
3 changed files with 33 additions and 33 deletions

View File

@@ -23,15 +23,15 @@ NS_ASSUME_NONNULL_BEGIN
/// A message handler used to dispatch messages received from the server.
@property(nonatomic) facebook::flipper::SocketMessageHandler messageHandler;
/// A certificate provider used to obtain the client certificate used for
/// authentication.
@property(nonatomic)
facebook::flipper::SocketCertificateProvider certificateProvider;
/// Initializes an instance of FliperWebSocketTransport with an endpoint URL.
/// @param url Endpoint URL used to establish the connection.
- (instancetype)initWithURL:(NSURL* _Nonnull)url;
/// A certificate provider used to obtain the client certificate used for
/// authentication.
- (void)setCertificateProvider:
(facebook::flipper::SocketCertificateProvider)certificateProvider;
/// Connect to the endpoint.
- (void)connect;