feat: add the --reconnect-timeout option

This commit is contained in:
Kevin Yue
2024-05-19 09:59:25 +08:00
parent 90a8c11acb
commit af51bc257b
7 changed files with 31 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ pub(crate) struct ConnectOptions {
pub csd_uid: u32,
pub csd_wrapper: *const c_char,
pub reconnect_timeout: u32,
pub mtu: u32,
pub disable_ipv6: u32,
}

View File

@@ -63,6 +63,7 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
INFO("OS: %s", options->os);
INFO("CSD_USER: %d", options->csd_uid);
INFO("CSD_WRAPPER: %s", options->csd_wrapper);
INFO("RECONNECT_TIMEOUT: %d", options->reconnect_timeout);
INFO("MTU: %d", options->mtu);
INFO("DISABLE_IPV6: %d", options->disable_ipv6);
@@ -137,7 +138,7 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
while (1)
{
int ret = openconnect_mainloop(vpninfo, 300, 10);
int ret = openconnect_mainloop(vpninfo, options->reconnect_timeout, 10);
if (ret)
{

View File

@@ -20,8 +20,8 @@ typedef struct vpn_options
const uid_t csd_uid;
const char *csd_wrapper;
const int reconnect_timeout;
const int mtu;
const int disable_ipv6;
} vpn_options;