diff options
| author | Fabian Mauchle <fabian.mauchle@switch.ch> | 2017-03-02 10:44:16 +0100 |
|---|---|---|
| committer | Fabian Mauchle <fabian.mauchle@switch.ch> | 2017-08-06 20:42:26 +0200 |
| commit | 05ed43d8d4bf254a503cee715034a8184615af9e (patch) | |
| tree | 9c3707b91c375b1e10e51ee4ce9bd00f70bacaee /tls.c | |
| parent | 14cac40266288157047c205d138d26ebcb042aa2 (diff) | |
replace server states with enum
Diffstat (limited to 'tls.c')
| -rw-r--r-- | tls.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -111,8 +111,8 @@ int tlsconnect(struct server *server, struct timeval *when, int timeout, char *t pthread_mutex_unlock(&server->lock); 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); @@ -155,7 +155,7 @@ int tlsconnect(struct server *server, struct timeval *when, int timeout, char *t X509_free(cert); } debug(DBG_WARN, "tlsconnect: TLS connection to %s up", server->conf->name); - server->connectionok = 1; + server->state = RSP_SERVER_STATE_CONNECTED; gettimeofday(&server->lastconnecttry, NULL); pthread_mutex_unlock(&server->lock); return 1; @@ -251,7 +251,7 @@ int clientradputtls(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) { |
