summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvenaas <venaas>2007-02-16 12:14:41 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2007-02-16 12:14:41 +0000
commit204c7ec18e84ce5463bad4ee124b5c5248f24bef (patch)
tree4c093eeaaf05390cc116f01708dd8b3df4607fc9
parent6f0105e2af9ee7d1e5bcdab93128535542ad7ef5 (diff)
don't exit when new thread can't be created after accept
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@63 e88ac4ed-0b26-0410-9574-a7f39faa03bf
-rw-r--r--radsecproxy.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index c1df34f..f6bdc6c 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -1513,6 +1513,7 @@ void *tlsserverrd(void *arg) {
errexit:
s = SSL_get_fd(ssl);
SSL_free(ssl);
+ shutdown(s, SHUT_RDWR);
close(s);
printf("tlsserverrd thread for %s exiting\n", client->peer.host);
client->peer.ssl = NULL;
@@ -1559,8 +1560,14 @@ int tlslistener() {
}
client->peer.ssl = SSL_new(ssl_ctx);
SSL_set_fd(client->peer.ssl, snew);
- if (pthread_create(&tlsserverth, NULL, tlsserverrd, (void *)client))
- errx("pthread_create failed");
+ if (pthread_create(&tlsserverth, NULL, tlsserverrd, (void *)client)) {
+ err("pthread_create failed");
+ SSL_free(client->peer.ssl);
+ shutdown(snew, SHUT_RDWR);
+ close(snew);
+ client->peer.ssl = NULL;
+ continue;
+ }
pthread_detach(tlsserverth);
}
return 0;