From a462a92822c08227337f65faa6ec61a15af872bb Mon Sep 17 00:00:00 2001
From: "Dmitriy A. Gerasimov" <dmitriy.gerasimov@demlabs.net>
Date: Mon, 9 Nov 2020 16:30:16 +0700
Subject: [PATCH] [*] Fixed dap_chain_node_client_wait()

---
 CMakeLists.txt                      | 2 +-
 dap-sdk/net/core/dap_worker.c       | 2 +-
 modules/net/dap_chain_net.c         | 3 +--
 modules/net/dap_chain_node_client.c | 3 +--
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2ac273dbb0..3376a163aa 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-30")
+set(CELLFRAME_SDK_NATIVE_VERSION "2.6-32")
 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 88d31927a2..3f67a46156 100644
--- a/dap-sdk/net/core/dap_worker.c
+++ b/dap-sdk/net/core/dap_worker.c
@@ -521,7 +521,7 @@ static void s_queue_add_es_callback( dap_events_socket_t * a_es, void * a_arg)
             l_es_new->me = l_es_new;
             HASH_ADD(hh_worker, w->esockets, me, sizeof(void *), l_es_new );
             w->event_sockets_count++;
-            log_it(L_DEBUG, "Added socket %d on worker %u", l_es_new->socket, w->id);
+            //log_it(L_DEBUG, "Added socket %d on worker %u", l_es_new->socket, w->id);
             if (l_es_new->callbacks.worker_assign_callback)
                 l_es_new->callbacks.worker_assign_callback(l_es_new, w);
 
diff --git a/modules/net/dap_chain_net.c b/modules/net/dap_chain_net.c
index c98f272665..075ad8a8a1 100644
--- a/modules/net/dap_chain_net.c
+++ b/modules/net/dap_chain_net.c
@@ -490,8 +490,7 @@ static int s_net_states_proc(dap_chain_net_t *a_net)
                 dap_chain_node_client_t *l_node_client = dap_chain_node_client_connect(l_link_info);
                 if (l_node_client) {
                     // wait connected
-                    int timeout_ms = 5000; //5 sec = 5000 ms
-                    int res = dap_chain_node_client_wait(l_node_client, NODE_CLIENT_STATE_CONNECTED, timeout_ms);
+                    int res = dap_chain_node_client_wait(l_node_client, NODE_CLIENT_STATE_CONNECTED, 10000 );
                     if (res == 0 ) {
                         log_it(L_DEBUG, "Established connection with "NODE_ADDR_FP_STR, NODE_ADDR_FP_ARGS_S(l_link_info->hdr.address));
                         l_pvt_net->links = dap_list_append(l_pvt_net->links, l_node_client);
diff --git a/modules/net/dap_chain_node_client.c b/modules/net/dap_chain_node_client.c
index e0e99708f4..497f9280ea 100644
--- a/modules/net/dap_chain_node_client.c
+++ b/modules/net/dap_chain_node_client.c
@@ -551,9 +551,8 @@ int dap_chain_node_client_wait(dap_chain_node_client_t *a_client, int a_waited_s
 #ifndef _WIN32
     // prepare for signal waiting
     struct timespec l_cond_timeout;
-    uint32_t l_timeout_s = dap_config_get_item_uint32_default(g_config,"chain_net","status_wait_timeout",10);
     clock_gettime( CLOCK_MONOTONIC, &l_cond_timeout);
-    l_cond_timeout.tv_sec += l_timeout_s;
+    l_cond_timeout.tv_sec += a_timeout_ms/1000;
 #else
     pthread_mutex_unlock( &a_client->wait_mutex );
 #endif
-- 
GitLab