radsecproxy-1.6.5.
[radsecproxy.git] / tls.c
diff --git a/tls.c b/tls.c
index 4a825ec..90c3dc9 100644 (file)
--- a/tls.c
+++ b/tls.c
@@ -290,8 +290,17 @@ void *tlsclientrd(void *arg) {
            }
        }
     }
+    debug(DBG_INFO, "tlsclientrd: exiting for %s", server->conf->name);
     ERR_remove_state(0);
+    SSL_shutdown(server->ssl);
+    shutdown(server->sock, SHUT_RDWR);
+    close(server->sock);
+
+    /* Wake up clientwr(). */
     server->clientrdgone = 1;
+    pthread_mutex_lock(&server->newrq_mutex);
+    pthread_cond_signal(&server->newrq_cond);
+    pthread_mutex_unlock(&server->newrq_mutex);
     return NULL;
 }
 
@@ -346,7 +355,7 @@ void tlsserverrd(struct client *client) {
     }
 
     for (;;) {
-       buf = radtlsget(client->ssl, 0);
+       buf = radtlsget(client->ssl, IDLE_TIMEOUT * 3);
        if (!buf) {
            debug(DBG_ERR, "tlsserverrd: connection from %s lost", addr2string(client->addr));
            break;