From 648afd3a17e1f0705740641d007e396a72f24cc0 Mon Sep 17 00:00:00 2001 From: Roman Khlopkov <roman.khlopkov@demlabs.net> Date: Thu, 20 Feb 2025 19:03:06 +0700 Subject: [PATCH] [*] SO_REUSE tempopary disabled --- core/include/dap_common.h | 4 ++++ io/dap_server.c | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/include/dap_common.h b/core/include/dap_common.h index 80ae791c6..43233995f 100755 --- a/core/include/dap_common.h +++ b/core/include/dap_common.h @@ -253,6 +253,9 @@ static inline void *s_vm_extend(const char *a_rtn_name, int a_rtn_line, void *a_ #define DAP_DUP_SIZE_RET_VAL_IF_FAIL(p, s, r, ...) ({ \ void *_p = DAP_DUP_SIZE(p, s); if (!_p) { log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_MULTY(__VA_ARGS__); return r; } _p; \ }) +#define DAP_DUP_RET_VAL_IF_FAIL(p, r, ...) ({ \ + void *_p = DAP_DUP(p); if (!_p) { log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_MULTY(__VA_ARGS__); return r; } _p; \ +}) #define DAP_REALLOC_RET_VAL_IF_FAIL(p, s, r, ...) ({ \ void *_p = DAP_REALLOC(p, s); if (!_p) { log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_MULTY(__VA_ARGS__); return r; } _p; \ }) @@ -263,6 +266,7 @@ static inline void *s_vm_extend(const char *a_rtn_name, int a_rtn_line, void *a_ #define DAP_NEW_Z_RET_IF_FAIL(t, ...) DAP_NEW_Z_RET_VAL_IF_FAIL(t, , __VA_ARGS__) #define DAP_NEW_Z_SIZE_RET_IF_FAIL(t, s, ...) DAP_NEW_Z_SIZE_RET_VAL_IF_FAIL(t, s, , __VA_ARGS__) #define DAP_NEW_Z_COUNT_RET_IF_FAIL(t, c, ...) DAP_NEW_Z_COUNT_RET_VAL_IF_FAIL(t, c, , __VA_ARGS__) +#define DAP_DUP_RET_IF_FAIL(p, ...) DAP_DUP_RET_VAL_IF_FAIL(p, , __VA_ARGS__) #define DAP_DUP_SIZE_RET_IF_FAIL(p, s, ...) DAP_DUP_SIZE_RET_VAL_IF_FAIL(p, s, , __VA_ARGS__) #define DAP_REALLOC_RET_IF_FAIL(p, s, ...) DAP_REALLOC_RET_VAL_IF_FAIL(p, s, , __VA_ARGS__) #define DAP_REALLOC_COUNT_RET_IF_FAIL(p, c, ...) DAP_REALLOC_COUNT_RET_VAL_IF_FAIL(p, c, , __VA_ARGS__) diff --git a/io/dap_server.c b/io/dap_server.c index d3e1beeae..0317f1541 100644 --- a/io/dap_server.c +++ b/io/dap_server.c @@ -194,12 +194,10 @@ int dap_server_listen_addr_add( dap_server_t *a_server, const char *a_addr, uint return 4; } -#ifdef SO_REUSEPORT +#if 0 // #ifdef SO_REUSEPORT l_option = 1; - if ( setsockopt(l_socket, SOL_SOCKET, SO_REUSEPORT, (const char*)&l_option, sizeof(int)) < 0 ) { - close_socket_due_to_fail("setsockopt(SO_REUSEPORT)"); - return 5; - } + if ( setsockopt(l_socket, SOL_SOCKET, SO_REUSEPORT, (const char*)&l_option, sizeof(int)) < 0 ) + debug_if(a_server->ext_log, L_INFO, "setsockopt(SO_REUSEPORT) is not supported"); #endif if ( bind(l_socket, (struct sockaddr*)&l_saddr, l_len) < 0 ) { -- GitLab