Invalidate sockets instead of setting flow as nil

This commit is contained in:
Sergey Abramchuk
2020-06-09 19:30:48 +03:00
parent abe0870828
commit 0326b93bea
@@ -319,7 +319,7 @@
void (^completionHandler)(id<OpenVPNAdapterPacketFlow> _Nullable) = ^(id<OpenVPNAdapterPacketFlow> flow) {
__strong typeof(self) self = weakSelf;
if (flow) {
if (flow && (self.packetFlowBridge == nil || self.packetFlowBridge != flow)) {
self.packetFlowBridge = [[OpenVPNPacketFlowBridge alloc] initWithPacketFlow:flow];
}
@@ -403,7 +403,7 @@
}
- (void)resetTun {
_packetFlowBridge = nil;
[_packetFlowBridge invalidateSocketsIfNeeded];
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);