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:
committed by
Facebook GitHub Bot
parent
b31f8c8755
commit
764e94503e
@@ -112,15 +112,15 @@ bool FlipperWebSocket::connect(FlipperConnectionManager* manager) {
|
||||
};
|
||||
|
||||
if (endpoint_.secure) {
|
||||
socket_.certificateProvider = [this](
|
||||
char* _Nonnull password, size_t length) {
|
||||
auto pkcs12 = connectionContextStore_->getCertificate();
|
||||
if (pkcs12.first.length() == 0) {
|
||||
return std::string("");
|
||||
}
|
||||
strncpy(password, pkcs12.second.c_str(), length);
|
||||
return pkcs12.first;
|
||||
};
|
||||
[socket_
|
||||
setCertificateProvider:[this](char* _Nonnull password, size_t length) {
|
||||
auto pkcs12 = connectionContextStore_->getCertificate();
|
||||
if (pkcs12.first.length() == 0) {
|
||||
return std::string("");
|
||||
}
|
||||
strncpy(password, pkcs12.second.c_str(), length);
|
||||
return pkcs12.first;
|
||||
}];
|
||||
}
|
||||
|
||||
[socket_ connect];
|
||||
|
||||
Reference in New Issue
Block a user