From 88b06b4c0f25ba48c7e913117a3d064fad1ab5b5 Mon Sep 17 00:00:00 2001
From: "Dmitriy A. Gerasimov" <dmitriy.gerasimov@demlabs.net>
Date: Thu, 17 Dec 2020 17:15:26 +0700
Subject: [PATCH] [*] Fixed timeouts

---
 CMakeLists.txt                       | 2 +-
 dap-sdk/net/client/dap_client_http.c | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ac00319ed8..8a9324203a 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-82")
+set(CELLFRAME_SDK_NATIVE_VERSION "2.6-83")
 add_definitions ("-DCELLFRAME_SDK_VERSION=\"${CELLFRAME_SDK_NATIVE_VERSION}\"")
 set(DAPSDK_MODULES "")
 
diff --git a/dap-sdk/net/client/dap_client_http.c b/dap-sdk/net/client/dap_client_http.c
index 21b64ff7ae..71916bafac 100644
--- a/dap-sdk/net/client/dap_client_http.c
+++ b/dap-sdk/net/client/dap_client_http.c
@@ -110,9 +110,12 @@ static void s_timer_timeout_check(void * a_arg)
 {
     dap_events_socket_t * l_es = (dap_events_socket_t*) a_arg;
     assert(l_es);
-    dap_worker_t * l_worker = l_es->worker; // We're in own esocket context
-    if( !l_worker) // Out of worker
-        return;
+    dap_events_t * l_events = dap_events_get_default();
+    assert(l_events);
+
+    dap_worker_t * l_worker =(dap_worker_t*) pthread_getspecific(l_events->pth_key_worker);; // We're in own esocket context
+    assert(l_worker);
+
     if(dap_events_socket_check_unsafe(l_worker, l_es) ){
         dap_client_http_pvt_t * l_http_pvt = PVT(l_es);
         log_it(L_WARNING,"Connection timeout for request http://%s:%u/%s, possible network problems or host is down",
-- 
GitLab