Pause vpn client

This commit is contained in:
Sergey Abramchuk 2017-05-01 12:26:09 +03:00
parent 105810082f
commit 099309c498
2 changed files with 13 additions and 0 deletions

View File

@ -161,6 +161,14 @@ NS_SWIFT_NAME(provide(credentials:));
*/
- (void)connect;
/**
Pause the client - useful to avoid continuous reconnection attempts
when network is down
@param pauseReason <#reason description#>
*/
- (void)pauseWithReason:(nullable NSString *)pauseReason;
/**
Close connection with the VPN server
*/

View File

@ -227,6 +227,11 @@ NSString * const OpenVPNAdapterErrorEventKey = @"me.ss-abramchuk.openvpn-adapter
});
}
- (void)pauseWithReason:(NSString *)pauseReason {
std::string reason = pauseReason ? std::string([pauseReason UTF8String]) : "";
self.vpnClient->pause(reason);
}
- (void)disconnect {
self.vpnClient->stop();
}