aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tcp_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tcp_server.c')
-rw-r--r--src/tcp_server.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tcp_server.c b/src/tcp_server.c
index 633b7f2..47317e7 100644
--- a/src/tcp_server.c
+++ b/src/tcp_server.c
@@ -1,6 +1,7 @@
#include "tcp_server.h"
#include "log.h"
#include "net.h"
+#include "signal.h"
#include <pthread.h>
#include <stdlib.h>
@@ -43,10 +44,8 @@ int tcp_server_accept(const struct tcp_server *server, tcp_server_conn_handler h
int conn_fd, ret = 0;
ret = net_accept(server->fd);
- if (ret < 0) {
- print_errno("accept");
+ if (ret < 0)
return ret;
- }
conn_fd = ret;
ctx = malloc(sizeof(*ctx));
@@ -69,6 +68,10 @@ int tcp_server_accept(const struct tcp_server *server, tcp_server_conn_handler h
goto destroy_attr;
}
+ ret = signal_set_thread_attr(&child_attr);
+ if (ret < 0)
+ goto destroy_attr;
+
ret = pthread_create(&child, &child_attr, connection_thread, ctx);
if (ret) {
pthread_print_errno(ret, "pthread_create");