if (ret == 1) {
vpninfo->progress(vpninfo, PRG_INFO, "Established DTLS connection\n");
- vpninfo->dtls_state = DTLS_RUNNING;
-
if (vpninfo->dtls_ssl) {
/* We are replacing an old connection */
SSL_free(vpninfo->dtls_ssl);
vpninfo->cafile = optarg;
break;
case '1':
- vpninfo->dtls_state = DTLS_NEVER;
+ vpninfo->dtls_attempt_period = 0;
break;
case '2':
cookieonly = 1;
exit(1);
}
- if (!vpninfo->dtls_state && setup_dtls(vpninfo))
+ if (vpninfo->dtls_attempt_period && setup_dtls(vpninfo))
fprintf(stderr, "Set up DTLS failed; using SSL instead\n");
printf("Connected %s as %s, using %s\n", vpninfo->ifname, vpninfo->vpn_addr,
if (vpninfo->new_dtls_ssl)
dtls_try_handshake(vpninfo);
- if (!vpninfo->dtls_ssl && !vpninfo->new_dtls_ssl &&
+ if (vpninfo->dtls_attempt_period && !vpninfo->dtls_ssl && !vpninfo->new_dtls_ssl &&
vpninfo->new_dtls_started + vpninfo->dtls_attempt_period < time(NULL)) {
vpninfo->progress(vpninfo, PRG_TRACE, "Attempt new DTLS connection\n");
connect_dtls_socket(vpninfo);
time_t last_dpd;
};
-#define DTLS_NEVER -1
-#define DTLS_CLOSED 0
-#define DTLS_HANDSHAKE 1
-#define DTLS_RUNNING 2
-
struct openconnect_info {
char *redirect_url;
int dtls_attempt_period;
time_t new_dtls_started;
- int dtls_state;
SSL_CTX *dtls_ctx;
SSL *dtls_ssl;
SSL *new_dtls_ssl;