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
15
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
2f7d3b82
Commit
2f7d3b82
authored
4 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[+] Additional check for input data
parent
efb9dee5
No related branches found
No related tags found
2 merge requests
!251
Master
,
!250
Master
Pipeline
#5869
passed with stage
in 13 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
modules/channel/chain/dap_stream_ch_chain.c
+58
-47
58 additions, 47 deletions
modules/channel/chain/dap_stream_ch_chain.c
with
59 additions
and
48 deletions
CMakeLists.txt
+
1
−
1
View file @
2f7d3b82
...
@@ -2,7 +2,7 @@ project(cellframe-sdk C)
...
@@ -2,7 +2,7 @@ project(cellframe-sdk C)
cmake_minimum_required
(
VERSION 2.8
)
cmake_minimum_required
(
VERSION 2.8
)
set
(
CMAKE_C_STANDARD 11
)
set
(
CMAKE_C_STANDARD 11
)
set
(
CELLFRAME_SDK_NATIVE_VERSION
"2.6-1
8
"
)
set
(
CELLFRAME_SDK_NATIVE_VERSION
"2.6-1
9
"
)
add_definitions
(
"-DCELLFRAME_SDK_VERSION=
\"
${
CELLFRAME_SDK_NATIVE_VERSION
}
\"
"
)
add_definitions
(
"-DCELLFRAME_SDK_VERSION=
\"
${
CELLFRAME_SDK_NATIVE_VERSION
}
\"
"
)
set
(
DAPSDK_MODULES
""
)
set
(
DAPSDK_MODULES
""
)
...
...
This diff is collapsed.
Click to expand it.
modules/channel/chain/dap_stream_ch_chain.c
+
58
−
47
View file @
2f7d3b82
...
@@ -226,61 +226,72 @@ bool s_chain_pkt_callback(dap_proc_thread_t *a_thread, void *a_arg)
...
@@ -226,61 +226,72 @@ bool s_chain_pkt_callback(dap_proc_thread_t *a_thread, void *a_arg)
dap_chain_pkt_copy_t
*
l_pkt_copy
=
(
dap_chain_pkt_copy_t
*
)
l_pkt_copy_list
->
data
;
dap_chain_pkt_copy_t
*
l_pkt_copy
=
(
dap_chain_pkt_copy_t
*
)
l_pkt_copy_list
->
data
;
dap_chain_atom_ptr_t
l_atom_copy
=
(
dap_chain_atom_ptr_t
)
l_pkt_copy
->
pkt_data
;
dap_chain_atom_ptr_t
l_atom_copy
=
(
dap_chain_atom_ptr_t
)
l_pkt_copy
->
pkt_data
;
uint64_t
l_atom_copy_size
=
l_pkt_copy
->
pkt_data_size
;
uint64_t
l_atom_copy_size
=
l_pkt_copy
->
pkt_data_size
;
dap_hash_fast
(
l_atom_copy
,
l_atom_copy_size
,
&
l_atom_hash
);
if
(
l_atom_copy_size
&&
l_pkt_copy
&&
l_atom_copy
){
dap_chain_atom_iter_t
*
l_atom_iter
=
l_chain
->
callback_atom_iter_create
(
l_chain
);
dap_hash_fast
(
l_atom_copy
,
l_atom_copy_size
,
&
l_atom_hash
);
size_t
l_atom_size
=
0
;
dap_chain_atom_iter_t
*
l_atom_iter
=
l_chain
->
callback_atom_iter_create
(
l_chain
);
if
(
l_chain
->
callback_atom_find_by_hash
(
l_atom_iter
,
&
l_atom_hash
,
&
l_atom_size
)
==
NULL
)
{
size_t
l_atom_size
=
0
;
dap_chain_atom_verify_res_t
l_atom_add_res
=
l_chain
->
callback_atom_add
(
l_chain
,
l_atom_copy
,
l_atom_copy_size
);
if
(
l_chain
->
callback_atom_find_by_hash
(
l_atom_iter
,
&
l_atom_hash
,
&
l_atom_size
)
==
NULL
)
{
if
(
l_atom_add_res
==
ATOM_ACCEPT
&&
dap_chain_has_file_store
(
l_chain
))
{
dap_chain_atom_verify_res_t
l_atom_add_res
=
l_chain
->
callback_atom_add
(
l_chain
,
l_atom_copy
,
l_atom_copy_size
);
// append to file
if
(
l_atom_add_res
==
ATOM_ACCEPT
&&
dap_chain_has_file_store
(
l_chain
))
{
dap_chain_cell_t
*
l_cell
=
dap_chain_cell_create_fill
(
l_chain
,
l_ch_chain
->
request_cell_id
);
// append to file
int
l_res
;
dap_chain_cell_t
*
l_cell
=
dap_chain_cell_create_fill
(
l_chain
,
l_ch_chain
->
request_cell_id
);
if
(
l_cell
)
{
int
l_res
;
// add one atom only
if
(
l_cell
)
{
l_res
=
dap_chain_cell_file_append
(
l_cell
,
l_atom_copy
,
l_atom_copy_size
);
// add one atom only
// rewrite all file
l_res
=
dap_chain_cell_file_append
(
l_cell
,
l_atom_copy
,
l_atom_copy_size
);
//l_res = dap_chain_cell_file_update(l_cell);
// rewrite all file
if
(
l_res
<
0
)
{
//l_res = dap_chain_cell_file_update(l_cell);
log_it
(
L_ERROR
,
"Can't save event 0x%x to the file '%s'"
,
l_atom_hash
,
if
(
l_res
<
0
)
{
l_cell
?
l_cell
->
file_storage_path
:
"[null]"
);
log_it
(
L_ERROR
,
"Can't save event 0x%x to the file '%s'"
,
l_atom_hash
,
}
l_cell
?
l_cell
->
file_storage_path
:
"[null]"
);
// add all atoms from treshold
}
if
(
l_chain
->
callback_atom_add_from_treshold
){
// add all atoms from treshold
dap_chain_atom_ptr_t
l_atom_treshold
;
if
(
l_chain
->
callback_atom_add_from_treshold
){
do
{
dap_chain_atom_ptr_t
l_atom_treshold
;
size_t
l_atom_treshold_size
;
do
{
// add into ledger
size_t
l_atom_treshold_size
;
log_it
(
L_DEBUG
,
"Try to add atom from treshold"
);
// add into ledger
l_atom_treshold
=
l_chain
->
callback_atom_add_from_treshold
(
l_chain
,
&
l_atom_treshold_size
);
log_it
(
L_DEBUG
,
"Try to add atom from treshold"
);
// add into file
l_atom_treshold
=
l_chain
->
callback_atom_add_from_treshold
(
l_chain
,
&
l_atom_treshold_size
);
if
(
l_atom_treshold
)
{
// add into file
l_res
=
dap_chain_cell_file_append
(
l_cell
,
l_atom_treshold
,
l_atom_treshold_size
);
if
(
l_atom_treshold
)
{
log_it
(
L_DEBUG
,
"Added atom from treshold"
);
l_res
=
dap_chain_cell_file_append
(
l_cell
,
l_atom_treshold
,
l_atom_treshold_size
);
if
(
l_res
<
0
)
{
log_it
(
L_DEBUG
,
"Added atom from treshold"
);
log_it
(
L_ERROR
,
"Can't save event 0x%x from treshold to the file '%s'"
,
if
(
l_res
<
0
)
{
l_atom_treshold
,
l_cell
?
l_cell
->
file_storage_path
:
"[null]"
);
log_it
(
L_ERROR
,
"Can't save event 0x%x from treshold to the file '%s'"
,
l_atom_treshold
,
l_cell
?
l_cell
->
file_storage_path
:
"[null]"
);
}
}
}
}
}
while
(
l_atom_treshold
);
}
}
while
(
l_atom_treshold
);
}
// delete cell and close file
// delete cell and close file
dap_chain_cell_delete
(
l_cell
);
dap_chain_cell_delete
(
l_cell
);
}
}
else
{
else
{
log_it
(
L_ERROR
,
"Can't get cell for cell_id 0x%x for save event to file"
,
l_ch_chain
->
request_cell_id
);
log_it
(
L_ERROR
,
"Can't get cell for cell_id 0x%x for save event to file"
,
l_ch_chain
->
request_cell_id
);
}
}
}
}
if
(
l_atom_add_res
==
ATOM_PASS
)
if
(
l_atom_add_res
==
ATOM_PASS
)
DAP_DELETE
(
l_atom_copy
);
}
else
{
DAP_DELETE
(
l_atom_copy
);
DAP_DELETE
(
l_atom_copy
);
}
else
{
}
DAP_DELETE
(
l_atom_copy
);
l_chain
->
callback_atom_iter_delete
(
l_atom_iter
);
}
else
{
if
(
!
l_pkt_copy
)
log_it
(
L_WARNING
,
"packet copy is NULL"
);
if
(
!
l_pkt_copy_list
)
log_it
(
L_WARNING
,
"packet copy list is NULL"
);
if
(
l_atom_copy_size
)
log_it
(
L_WARNING
,
"Atom copy size is zero"
);
}
}
l_chain
->
callback_atom_iter_delete
(
l_atom_iter
);
if
(
l_pkt_copy
)
DAP_DELETE
(
l_pkt_copy
);
DAP_DELETE
(
l_pkt_copy
);
DAP_DELETE
(
l_pkt_copy_list
);
if
(
l_pkt_copy_list
)
DAP_DELETE
(
l_pkt_copy_list
);
}
else
}
else
log_it
(
L_WARNING
,
"In proc thread got CHAINS stream ch packet with zero data"
);
log_it
(
L_WARNING
,
"In proc thread got CHAINS stream ch packet with zero data"
);
dap_events_socket_assign_on_worker_mt
(
l_ch
->
stream
->
esocket
,
l_ch
->
stream_worker
->
worker
);
dap_events_socket_assign_on_worker_mt
(
l_ch
->
stream
->
esocket
,
l_ch
->
stream_worker
->
worker
);
...
...
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