summaryrefslogtreecommitdiff
path: root/dtls.c
diff options
context:
space:
mode:
authorFabian Mauchle <fabian.mauchle@switch.ch>2017-03-02 10:44:16 +0100
committerFabian Mauchle <fabian.mauchle@switch.ch>2017-03-16 11:16:58 +0100
commit6be11441945bf33f807568d8566dffc7fef9174f (patch)
tree42e1656d74a9e593e54a24e68a42c50145a6102d /dtls.c
parent750a3811adb90c9727b11af1fb385862da8a6f60 (diff)
replace server states with enum
Conflicts: radsecproxy.c radsecproxy.h
Diffstat (limited to 'dtls.c')
-rw-r--r--dtls.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/dtls.c b/dtls.c
index 1a8f5e5..4b65313 100644
--- a/dtls.c
+++ b/dtls.c
@@ -556,8 +556,8 @@ int dtlsconnect(struct server *server, struct timeval *when, int timeout, char *
return 0;
}
- if (server->connectionok) {
- server->connectionok = 0;
+ if (server->state == SERVER_STATE_CONNECTED) {
+ server->state = SERVER_STATE_RECONNECTING;
sleep(2);
} else if (elapsed < 1)
sleep(2);
@@ -591,7 +591,7 @@ int dtlsconnect(struct server *server, struct timeval *when, int timeout, char *
}
X509_free(cert);
debug(DBG_WARN, "dtlsconnect: DTLS connection to %s port %s up", hp->host, hp->port);
- server->connectionok = 1;
+ server->state = SERVER_STATE_CONNECTED;
gettimeofday(&server->lastconnecttry, NULL);
pthread_mutex_unlock(&server->lock);
return 1;
@@ -603,7 +603,7 @@ int clientradputdtls(struct server *server, unsigned char *rad) {
unsigned long error;
struct clsrvconf *conf = server->conf;
- if (!server->connectionok)
+ if (!server->state == SERVER_STATE_CONNECTED)
return 0;
len = RADLEN(rad);
if ((cnt = SSL_write(server->ssl, rad, len)) <= 0) {