aboutsummaryrefslogtreecommitdiff
path: root/networks/openssl.c
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2024-06-21 09:02:51 -0400
committerTest_User <hax@andrewyu.org>2024-06-21 19:55:27 -0400
commitfbd7fc576fb73e9c536cc42a7f2d66b96261e1f0 (patch)
tree889d9c868b71c78e79cdf107911153e58eb51478 /networks/openssl.c
parentef6f87193ab6628a2366b004a21c5cb21304c663 (diff)
downloadhaxircd-fbd7fc576fb73e9c536cc42a7f2d66b96261e1f0.tar.gz
haxircd-fbd7fc576fb73e9c536cc42a7f2d66b96261e1f0.zip
-pthread mutex, +semaphores
Diffstat (limited to 'networks/openssl.c')
-rw-r--r--networks/openssl.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/networks/openssl.c b/networks/openssl.c
index 6b67f11..8d41c25 100644
--- a/networks/openssl.c
+++ b/networks/openssl.c
@@ -237,9 +237,7 @@ int openssl_connect(void **handle, struct string address, struct string port, st
goto openssl_connect_free_openssl_handle;
SSL_set_fd(openssl_handle->ssl, fd);
- res = mutex_init(&(openssl_handle->mutex));
- if (res != 0)
- goto openssl_connect_free_ssl;
+ mutex_init(&(openssl_handle->mutex));
struct pollfd pollfd = {
.fd = fd,
@@ -283,7 +281,6 @@ int openssl_connect(void **handle, struct string address, struct string port, st
openssl_connect_destroy_mutex:
mutex_destroy(&(openssl_handle->mutex));
- openssl_connect_free_ssl:
SSL_free(openssl_handle->ssl);
openssl_connect_free_openssl_handle:
free(openssl_handle);
@@ -338,13 +335,12 @@ int openssl_accept(int listen_fd, void **handle, struct string *addr) {
SSL_set_fd(openssl_handle->ssl, con_fd);
- int res = mutex_init(&(openssl_handle->mutex));
- if (res != 0)
- goto openssl_accept_free_ssl;
+ mutex_init(&(openssl_handle->mutex));
struct pollfd pollfd = {
.fd = con_fd,
};
+ int res;
do {
res = SSL_accept(openssl_handle->ssl);
if (res == 0)
@@ -384,7 +380,6 @@ int openssl_accept(int listen_fd, void **handle, struct string *addr) {
openssl_accept_destroy_mutex:
mutex_destroy(&(openssl_handle->mutex));
- openssl_accept_free_ssl:
SSL_free(openssl_handle->ssl);
openssl_accept_free_openssl_handle:
free(openssl_handle);