From 05ed43d8d4bf254a503cee715034a8184615af9e Mon Sep 17 00:00:00 2001 From: Fabian Mauchle Date: Thu, 2 Mar 2017 10:44:16 +0100 Subject: replace server states with enum --- dtls.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'dtls.c') diff --git a/dtls.c b/dtls.c index daeacca..fbbdd3b 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 == RSP_SERVER_STATE_CONNECTED) { + server->state = RSP_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 = RSP_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 != RSP_SERVER_STATE_CONNECTED) return 0; len = RADLEN(rad); if ((cnt = SSL_write(server->ssl, rad, len)) <= 0) { -- cgit v1.1