Use method argument instead of property to provide packet flow

This commit is contained in:
Sergey Abramchuk 2020-06-10 08:44:43 +03:00
parent d16a8ddade
commit b357c50067
2 changed files with 5 additions and 16 deletions

View File

@ -96,11 +96,6 @@ NS_SWIFT_NAME(openVPNAdapter(_:handleEvent:message:));
*/
@property (nonatomic, class, readonly) NSString *platform;
/**
*/
@property (nonatomic, weak) id<OpenVPNAdapterPacketFlow> packetFlow;
/**
The object that acts as the delegate of the adapter.
*/
@ -154,8 +149,10 @@ NS_SWIFT_NAME(apply(configuration:));
/**
Starts the tunnel.
@param packetFlow The object implementing OpenVPNAdapterPacketFlow protocol.
*/
- (void)connect;
- (void)connectUsingPacketFlow:(id<OpenVPNAdapterPacketFlow>)packetFlow NS_SWIFT_NAME(connect(using:));
/**
Pauses the tunnel.

View File

@ -86,8 +86,8 @@
return YES;
}
- (void)connect {
NSAssert(self.packetFlow != nil, @"packetFlow property shouldn't be nil, set it before trying to establish connection.");
- (void)connectUsingPacketFlow:(id<OpenVPNAdapterPacketFlow>)packetFlow {
self.packetFlowBridge.packetFlow = packetFlow;
dispatch_queue_attr_t attributes = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_UTILITY, 0);
dispatch_queue_t connectQueue = dispatch_queue_create("me.ss-abramchuk.openvpn-adapter.connection.", attributes);
@ -168,14 +168,6 @@
return _networkSettingsBuilder;
}
- (id<OpenVPNAdapterPacketFlow>)packetFlow {
return self.packetFlowBridge.packetFlow;
}
- (void)setPacketFlow:(id<OpenVPNAdapterPacketFlow>)packetFlow {
self.packetFlowBridge.packetFlow = packetFlow;
}
#pragma mark - OpenVPNClientDelegate
- (BOOL)setRemoteAddress:(NSString *)address {