From e945a5091b8c1669bfdd2a5de670bcbc2e433073 Mon Sep 17 00:00:00 2001 From: "Dmitriy A. Gerasimov" <dmitriy.gerasimov@demlabs.net> Date: Sat, 9 Jan 2021 23:43:16 +0700 Subject: [PATCH] [+] Added check if esocket was deleted on previous loop iteration --- CMakeLists.txt | 2 +- dap-sdk/net/core/dap_worker.c | 5 +++++ dap-sdk/net/core/include/dap_worker.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a8ab3b084..adf7937ab3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ project(cellframe-sdk C) cmake_minimum_required(VERSION 2.8) set(CMAKE_C_STANDARD 11) -set(CELLFRAME_SDK_NATIVE_VERSION "2.6-102") +set(CELLFRAME_SDK_NATIVE_VERSION "2.6-103") add_definitions ("-DCELLFRAME_SDK_VERSION=\"${CELLFRAME_SDK_NATIVE_VERSION}\"") set(DAPSDK_MODULES "") diff --git a/dap-sdk/net/core/dap_worker.c b/dap-sdk/net/core/dap_worker.c index 91cd4bce29..1acbb2afc6 100644 --- a/dap-sdk/net/core/dap_worker.c +++ b/dap-sdk/net/core/dap_worker.c @@ -179,6 +179,10 @@ void *dap_worker_thread(void *arg) l_flag_nval = false; #elif defined ( DAP_EVENTS_CAPS_POLL) short l_cur_events =l_worker->poll[n].revents; + + if (l_worker->poll[n].fd == -1) // If it was deleted on previous iterations + continue; + if (!l_cur_events) // No events for this socket continue; l_flag_hup = l_cur_events& POLLHUP; @@ -645,6 +649,7 @@ void *dap_worker_thread(void *arg) log_it(L_NOTICE,"Worker :%u finished", l_worker->id); return NULL; } + } #ifdef DAP_EVENTS_CAPS_POLL /***********************************************************/ diff --git a/dap-sdk/net/core/include/dap_worker.h b/dap-sdk/net/core/include/dap_worker.h index 0182843e6d..e648486373 100644 --- a/dap-sdk/net/core/include/dap_worker.h +++ b/dap-sdk/net/core/include/dap_worker.h @@ -43,6 +43,7 @@ typedef struct dap_worker // Signal to exit bool signal_exit; + // worker control queues dap_events_socket_t * queue_es_new; // Queue socket for new socket dap_events_socket_t ** queue_es_new_input; // Queue socket for new socket -- GitLab