Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cellframe-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
18
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
cellframe-sdk
Commits
cc3d2646
Commit
cc3d2646
authored
6 months ago
by
Roman Khlopkov
🔜
Committed by
Constantin P.
6 months ago
Browse files
Options
Downloads
Patches
Plain Diff
hotfix-12855
parent
083f0f21
No related branches found
Branches containing commit
No related tags found
1 merge request
!1775
hotfix-12855
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
3rdparty/libmaxminddb/CMakeLists.txt
+1
-4
1 addition, 4 deletions
3rdparty/libmaxminddb/CMakeLists.txt
modules/net/dap_chain_net.c
+32
-30
32 additions, 30 deletions
modules/net/dap_chain_net.c
modules/net/include/dap_chain_net.h
+2
-1
2 additions, 1 deletion
modules/net/include/dap_chain_net.h
with
35 additions
and
35 deletions
3rdparty/libmaxminddb/CMakeLists.txt
+
1
−
4
View file @
cc3d2646
...
@@ -12,7 +12,7 @@ add_library(${PROJECT_NAME} STATIC ${maxminddb_src} ${maxminddb_h})
...
@@ -12,7 +12,7 @@ add_library(${PROJECT_NAME} STATIC ${maxminddb_src} ${maxminddb_h})
set_target_properties
(
${
PROJECT_NAME
}
PROPERTIES LINKER_LANGUAGE C
)
set_target_properties
(
${
PROJECT_NAME
}
PROPERTIES LINKER_LANGUAGE C
)
set_target_properties
(
${
PROJECT_NAME
}
PROPERTIES COMPILER_LANGUAGE C
)
set_target_properties
(
${
PROJECT_NAME
}
PROPERTIES COMPILER_LANGUAGE C
)
target_include_directories
(
${
PROJECT_NAME
}
INTERFACE .
)
target_include_directories
(
${
PROJECT_NAME
}
INTERFACE .
)
target_compile_options
(
${
PROJECT_NAME
}
PRIVATE -Wno-sign-compare
)
target_compile_options
(
${
PROJECT_NAME
}
PRIVATE -Wno-sign-compare
-Wno-pointer-sign
)
if
(
INSTALL_SDK
)
if
(
INSTALL_SDK
)
set_target_properties
(
${
PROJECT_NAME
}
PROPERTIES PUBLIC_HEADER
"
${
maxminddb_h
}
"
)
set_target_properties
(
${
PROJECT_NAME
}
PROPERTIES PUBLIC_HEADER
"
${
maxminddb_h
}
"
)
...
@@ -22,7 +22,4 @@ INSTALL(TARGETS ${PROJECT_NAME}
...
@@ -22,7 +22,4 @@ INSTALL(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib/modules/net/
ARCHIVE DESTINATION lib/modules/net/
PUBLIC_HEADER DESTINATION include/modules/net/maxminddb/
PUBLIC_HEADER DESTINATION include/modules/net/maxminddb/
)
)
endif
()
endif
()
This diff is collapsed.
Click to expand it.
modules/net/dap_chain_net.c
+
32
−
30
View file @
cc3d2646
...
@@ -2368,37 +2368,32 @@ bool s_net_load(void *a_arg)
...
@@ -2368,37 +2368,32 @@ bool s_net_load(void *a_arg)
l_chain
->
callback_created
(
l_chain
,
l_net
->
pub
.
config
);
l_chain
->
callback_created
(
l_chain
,
l_net
->
pub
.
config
);
if
(
dap_config_get_item_bool_default
(
g_config
,
"server"
,
"enabled"
,
false
)
)
{
if
(
dap_config_get_item_bool_default
(
g_config
,
"server"
,
"enabled"
,
false
)
)
{
if
(
!
l_net_pvt
->
node_info
->
ext_port
)
{
char
l_host
[
DAP_HOSTADDR_STRLEN
+
1
]
=
{
'\0'
};
char
l_host
[
DAP_HOSTADDR_STRLEN
+
1
]
=
{
'\0'
};
uint16_t
l_ext_port
=
0
;
uint16_t
l_ext_port
=
0
;
const
char
*
l_ext_addr
=
dap_config_get_item_str_default
(
g_config
,
"server"
,
"ext_address"
,
NULL
);
const
char
*
l_ext_addr
=
dap_config_get_item_str_default
(
g_config
,
"server"
,
"ext_address"
,
NULL
);
if
(
l_ext_addr
)
{
if
(
!
l_ext_addr
)
{
struct
sockaddr_storage
l_saddr
=
{
};
log_it
(
L_INFO
,
"External address is not set, will be detected automatically"
);
if
(
0
>
dap_net_parse_config_address
(
l_ext_addr
,
l_host
,
&
l_ext_port
,
&
l_saddr
,
NULL
)
)
}
else
{
log_it
(
L_ERROR
,
"Invalid server address
\"
%s
\"
, fix config and restart node"
,
l_ext_addr
);
struct
sockaddr_storage
l_saddr
=
{
};
else
{
if
(
0
>
dap_net_parse_config_address
(
l_ext_addr
,
l_host
,
&
l_ext_port
,
&
l_saddr
,
NULL
)
)
uint8_t
l_hostlen
=
dap_strlen
(
l_host
);
log_it
(
L_ERROR
,
"Invalid server address
\"
%s
\"
, fix config and restart node"
,
l_ext_addr
);
l_net_pvt
->
node_info
->
ext_port
=
l_ext_port
;
else
{
l_net_pvt
->
node_info
->
ext_host_len
=
dap_strncpy
(
l_net_pvt
->
node_info
->
ext_host
,
l_host
,
l_hostlen
)
-
l_net_pvt
->
node_info
->
ext_host
;
uint8_t
l_hostlen
=
dap_strlen
(
l_host
);
l_net_pvt
->
node_info
->
ext_port
=
l_ext_port
;
l_net_pvt
->
node_info
->
ext_host_len
=
dap_strncpy
(
l_net_pvt
->
node_info
->
ext_host
,
l_host
,
l_hostlen
)
-
l_net_pvt
->
node_info
->
ext_host
;
}
}
if
(
!
l_net_pvt
->
node_info
->
ext_port
)
{
const
char
**
l_listening
=
dap_config_get_array_str
(
g_config
,
"server"
,
DAP_CFG_PARAM_LISTEN_ADDRS
,
NULL
);
l_net_pvt
->
node_info
->
ext_port
=
(
l_listening
&&
dap_net_parse_config_address
(
*
l_listening
,
NULL
,
&
l_ext_port
,
NULL
,
NULL
)
>
0
&&
l_ext_port
)
?
l_ext_port
:
dap_config_get_item_int16_default
(
g_config
,
"server"
,
DAP_CFG_PARAM_LEGACY_PORT
,
8079
);
// TODO: default port?
}
}
}
// otherwise, we're in seed list - seed config predominates server config thus disambiguating the settings
if
(
l_net_pvt
->
node_info
->
ext_host_len
)
{
log_it
(
L_INFO
,
"Server is configured with external address %s : %u"
,
l_net_pvt
->
node_info
->
ext_host
,
l_net_pvt
->
node_info
->
ext_port
);
}
}
}
else
#ifdef DAP_TRY_DEFAULT_PORT
log_it
(
L_INFO
,
"Server is disabled"
);
log_it
(
L_INFO
,
"External address is not set, will be detected automatically"
);
if
(
!
l_net_pvt
->
node_info
->
ext_port
)
{
const
char
**
l_listening
=
dap_config_get_array_str
(
g_config
,
"server"
,
DAP_CFG_PARAM_LISTEN_ADDRS
,
NULL
);
l_net_pvt
->
node_info
->
ext_port
=
(
l_listening
&&
dap_net_parse_config_address
(
*
l_listening
,
NULL
,
&
l_ext_port
,
NULL
,
NULL
)
>
0
&&
l_ext_port
)
?
l_ext_port
:
dap_config_get_item_int16_default
(
g_config
,
"server"
,
DAP_CFG_PARAM_LEGACY_PORT
,
8079
);
}
#endif
log_it
(
L_INFO
,
"Server is configured with external address %s : %u"
,
l_net_pvt
->
node_info
->
ext_host_len
?
l_net_pvt
->
node_info
->
ext_host
:
""
,
l_net_pvt
->
node_info
->
ext_port
);
}
l_net_pvt
->
node_info
->
address
.
uint64
=
g_node_addr
.
uint64
;
l_net_pvt
->
node_info
->
address
.
uint64
=
g_node_addr
.
uint64
;
...
@@ -3374,7 +3369,14 @@ uint256_t dap_chain_net_get_reward(dap_chain_net_t *a_net, uint64_t a_block_num)
...
@@ -3374,7 +3369,14 @@ uint256_t dap_chain_net_get_reward(dap_chain_net_t *a_net, uint64_t a_block_num)
return
uint256_0
;
return
uint256_0
;
}
}
void
dap_chain_net_announce_addrs
(
dap_chain_net_t
*
a_net
)
void
dap_chain_net_announce_addr_all
()
{
for
(
dap_chain_net_item_t
*
it
=
s_net_items
;
it
;
it
=
it
->
hh
.
next
)
dap_chain_net_announce_addr
(
it
->
chain_net
);
}
void
dap_chain_net_announce_addr
(
dap_chain_net_t
*
a_net
)
{
{
dap_return_if_fail
(
a_net
);
dap_return_if_fail
(
a_net
);
dap_chain_net_pvt_t
*
l_net_pvt
=
PVT
(
a_net
);
dap_chain_net_pvt_t
*
l_net_pvt
=
PVT
(
a_net
);
...
...
This diff is collapsed.
Click to expand it.
modules/net/include/dap_chain_net.h
+
2
−
1
View file @
cc3d2646
...
@@ -201,7 +201,8 @@ int dap_chain_datum_add(dap_chain_t * a_chain, dap_chain_datum_t *a_datum, size_
...
@@ -201,7 +201,8 @@ int dap_chain_datum_add(dap_chain_t * a_chain, dap_chain_datum_t *a_datum, size_
int
dap_chain_datum_remove
(
dap_chain_t
*
a_chain
,
dap_chain_datum_t
*
a_datum
,
size_t
a_datum_size
,
dap_hash_fast_t
*
a_datum_hash
);
int
dap_chain_datum_remove
(
dap_chain_t
*
a_chain
,
dap_chain_datum_t
*
a_datum
,
size_t
a_datum_size
,
dap_hash_fast_t
*
a_datum_hash
);
bool
dap_chain_net_get_load_mode
(
dap_chain_net_t
*
a_net
);
bool
dap_chain_net_get_load_mode
(
dap_chain_net_t
*
a_net
);
void
dap_chain_net_announce_addrs
(
dap_chain_net_t
*
a_net
);
void
dap_chain_net_announce_addr
(
dap_chain_net_t
*
a_net
);
void
dap_chain_net_announce_addr_all
();
char
*
dap_chain_net_links_dump
(
dap_chain_net_t
*
);
char
*
dap_chain_net_links_dump
(
dap_chain_net_t
*
);
struct
json_object
*
dap_chain_net_states_json_collect
(
dap_chain_net_t
*
l_net
);
struct
json_object
*
dap_chain_net_states_json_collect
(
dap_chain_net_t
*
l_net
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment