Define OpenVPNAdapterPacketFlow and use it instead of NEPacketTunnelFlow object to simplify testing

This commit is contained in:
Sergey Abramchuk
2017-03-09 19:08:24 +03:00
parent 3c840cd0f8
commit 1e886eaca7
4 changed files with 24 additions and 7 deletions
+2 -2
View File
@@ -43,7 +43,7 @@ NSString * const OpenVPNAdapterErrorEventKey = @"me.ss-abramchuk.openvpn-adapter
@property CFSocketRef vpnSocket;
@property CFSocketRef tunSocket;
@property (weak, nonatomic) NEPacketTunnelFlow *packetFlow;
@property (weak, nonatomic) id<OpenVPNAdapterPacketFlow> packetFlow;
- (void)readTUNPackets;
- (void)readVPNData:(NSData *)data;
@@ -199,7 +199,7 @@ static void socketCallback(CFSocketRef socket, CFSocketCallBackType type, CFData
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
[self.delegate configureTunnelWithSettings:networkSettings callback:^(NEPacketTunnelFlow * _Nullable flow) {
[self.delegate configureTunnelWithSettings:networkSettings callback:^(id<OpenVPNAdapterPacketFlow> _Nullable flow) {
self.packetFlow = flow;
dispatch_semaphore_signal(sema);
}];