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
16
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
64efa704
Commit
64efa704
authored
1 week ago
by
pavel.uhanov
Browse files
Options
Downloads
Patches
Plain Diff
[*] add authorized nodes init
parent
69881b91
No related branches found
No related tags found
No related merge requests found
Pipeline
#52203
failed with stage
in 12 minutes and 15 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/net/dap_chain_node_cli.c
+1
-1
1 addition, 1 deletion
modules/net/dap_chain_node_cli.c
modules/net/dap_chain_node_rpc.c
+17
-8
17 additions, 8 deletions
modules/net/dap_chain_node_rpc.c
with
18 additions
and
9 deletions
modules/net/dap_chain_node_cli.c
+
1
−
1
View file @
64efa704
...
...
@@ -66,7 +66,7 @@ int dap_chain_node_cli_init(dap_config_t * g_config)
if
(
dap_cli_server_init
(
s_debug_cli
,
"cli-server"
)
)
return
log_it
(
L_ERROR
,
"Can't init CLI server!"
),
-
1
;
if
(
dap_config_get_item_bool_default
(
g_config
,
"cli-server"
,
"rpc"
,
false
))
{
dap_chain_node_rpc_init
();
dap_chain_node_rpc_init
(
g_config
);
}
dap_cli_server_cmd_add
(
"global_db"
,
com_global_db
,
"Work with global database"
,
...
...
This diff is collapsed.
Click to expand it.
modules/net/dap_chain_node_rpc.c
+
17
−
8
View file @
64efa704
...
...
@@ -31,12 +31,9 @@
#include
<sys/sysinfo.h>
#include
<sys/vfs.h>
#include
"dap_hash.h"
#include
"dap_chain_net.h"
#include
"dap_global_db.h"
#include
"dap_chain_node.h"
#include
"dap_chain_cs_esbocs.h"
#include
"dap_chain_ledger.h"
#include
"dap_stream.h"
#define LOG_TAG "dap_chain_node_rpc"
#define DAP_CHAIN_NODE_RPC_STATES_INFO_CURRENT_VERSION 1
...
...
@@ -68,9 +65,9 @@ static void s_update_node_rpc_states_info(UNUSED_ARG void *a_arg)
l_info
->
links_count
=
dap_stream_get_links_count
();
sysinfo
(
&
l_info
->
sysinfo
);
//
const char *l_node_addr_str = dap_stream_node_addr_to_str_static(l_info->address);
//
dap_global_db_set_sync(
l_gdb
_group, l_node_addr_str, l_info,
l_info_size
, false);
//
DAP_DELETE(l_info);
const
char
*
l_node_addr_str
=
dap_stream_node_addr_to_str_static
(
l_info
->
address
);
dap_global_db_set_sync
(
s_rpc_states
_group
,
l_node_addr_str
,
l_info
,
sizeof
(
dap_chain_node_rpc_states_info_t
)
,
false
);
DAP_DELETE
(
l_info
);
}
static
void
s_states_info_to_str
(
dap_chain_net_t
*
a_net
,
const
char
*
a_node_addr_str
,
dap_string_t
*
l_info_str
)
...
...
@@ -126,14 +123,26 @@ static void s_states_info_to_str(dap_chain_net_t *a_net, const char *a_node_addr
// DAP_DELETE(l_node_info);
}
void
dap_chain_node_rpc_init
()
void
dap_chain_node_rpc_init
(
dap_config_t
*
a_cfg
)
{
if
(
!
(
s_rpc_states_cluster
=
dap_global_db_cluster_add
(
dap_global_db_instance_get_default
(),
DAP_STREAM_CLUSTER_GLOBAL
,
*
(
dap_guuid_t
*
)
&
uint128_0
,
s_rpc_states_group
,
0
,
true
,
DAP_GDB_MEMBER_ROLE_USER
,
DAP_CLUSTER_TYPE_EMBEDDED
)))
return
;
if
(
!
(
s_rpc_list_cluster
=
dap_global_db_cluster_add
(
dap_global_db_instance_get_default
(),
DAP_STREAM_CLUSTER_GLOBAL
,
*
(
dap_guuid_t
*
)
&
uint128_0
,
s_rpc_list_group
,
0
,
true
,
DAP_GDB_MEMBER_ROLE_GUEST
,
DAP_CLUSTER_TYPE_EMBEDDED
)))
return
;
dap_stream_node_addr_t
*
l_authorized_nodes
=
NULL
;
uint16_t
l_authorized_nodes_count
=
0
;
dap_config_stream_addrs_parse
(
a_cfg
,
"cli-server"
,
"authorized_nodes_addrs_rpc"
,
&
l_authorized_nodes
,
&
l_authorized_nodes_count
);
for
(
uint16_t
i
=
0
;
i
<
l_authorized_nodes_count
;
++
i
)
dap_global_db_cluster_member_add
(
s_rpc_list_cluster
,
l_authorized_nodes
+
i
,
DAP_GDB_MEMBER_ROLE_ROOT
);
DAP_DELETE
(
l_authorized_nodes
);
if
(
dap_proc_thread_timer_add
(
NULL
,
s_update_node_rpc_states_info
,
NULL
,
s_timer_update_states_info
))
log_it
(
L_ERROR
,
"Can't activate timer on node states update"
);
}
...
...
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