From da9aee33c1f763b2c852fc72bba986597afc2d82 Mon Sep 17 00:00:00 2001
From: armatusmiles <akurotych@gmail.com>
Date: Tue, 12 Feb 2019 16:35:25 +0700
Subject: [PATCH] [+] return from accept_cb if socket accept error

---
 dap_server.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dap_server.c b/dap_server.c
index c47dd07..b9ecb9b 100644
--- a/dap_server.c
+++ b/dap_server.c
@@ -283,9 +283,12 @@ static inline void print_online()
 static void accept_cb (struct ev_loop* loop, struct ev_io* watcher, int revents)
 {
     int client_fd = accept(watcher->fd, 0, 0);
-    log_it(L_INFO, "Client accept socket %d", client_fd);
-    if( client_fd < 0 )
-        log_it(L_ERROR, "error accept");
+    if( client_fd < 0 ) {
+        log_it(L_ERROR, "error accept socket");
+        return;
+    }
+
+    log_it(L_INFO, "Client accept socket %d", client_fd););
     set_nonblock_socket(client_fd);
 
     uint8_t indx_min = get_thread_index_min_connections();
-- 
GitLab