aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/main.c b/main.c
index e3ba683..1ec66bc 100644
--- a/main.c
+++ b/main.c
@@ -39,6 +39,14 @@
#include "types.h"
void *client_loop(void *ign) {
+ while (!client_listen_fd_ready) {
+ if (bind(client_listen_fd, (struct sockaddr *)&client_listen_fd_bind_addr, sizeof(client_listen_fd_bind_addr)) == -1) {
+ sleep(1);
+ } else {
+ client_listen_fd_ready = 1;
+ }
+ }
+
pthread_mutex_lock(&send_lock);
while (1) {
struct string full_msg = {.data = malloc(0), .len = 0};