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
ade84d88
Commit
ade84d88
authored
5 years ago
by
alexander.lysikov
Browse files
Options
Downloads
Patches
Plain Diff
added the attempt connect counter
parent
d23a5b00
No related branches found
No related tags found
1 merge request
!24
Support 3689
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dap_chain_node_client.c
+20
-3
20 additions, 3 deletions
dap_chain_node_client.c
with
20 additions
and
3 deletions
dap_chain_node_client.c
+
20
−
3
View file @
ade84d88
...
...
@@ -127,17 +127,30 @@ static void s_stage_status_callback(dap_client_t *a_client, void *a_arg)
*/
static
void
s_stage_status_error_callback
(
dap_client_t
*
a_client
,
void
*
a_arg
)
{
(
void
)
a_arg
;
dap_chain_node_client_t
*
l_node_client
=
DAP_CHAIN_NODE_CLIENT
(
a_client
);
// check for last attempt
bool
l_is_last_attempt
=
a_arg
?
true
:
false
;
if
(
l_is_last_attempt
){
pthread_mutex_lock
(
&
l_node_client
->
wait_mutex
);
l_node_client
->
state
=
NODE_CLIENT_STATE_DISCONNECTED
;
pthread_mutex_unlock
(
&
l_node_client
->
wait_mutex
);
#ifndef _WIN32
pthread_cond_signal
(
&
l_node_client
->
wait_cond
);
#else
SetEvent
(
l_node_client
->
wait_cond
);
#endif
}
if
(
l_node_client
&&
l_node_client
->
keep_connection
&&
((
dap_client_get_stage
(
a_client
)
!=
STAGE_STREAM_STREAMING
)
||
(
dap_client_get_stage_status
(
a_client
)
==
STAGE_STATUS_ERROR
)))
{
log_it
(
L_NOTICE
,
"Some errors happends, current state is %s but we need to return back to STAGE_STREAM_STREAMING"
,
dap_client_get_stage_str
(
a_client
)
);
pthread_mutex_unlock
(
&
l_node_client
->
wait_mutex
);
log_it
(
L_DEBUG
,
"Wakeup all who waits"
);
pthread_mutex_lock
(
&
l_node_client
->
wait_mutex
);
l_node_client
->
state
=
NODE_CLIENT_STATE_ERROR
;
pthread_mutex_unlock
(
&
l_node_client
->
wait_mutex
);
#ifndef _WIN32
pthread_cond_signal
(
&
l_node_client
->
wait_cond
);
...
...
@@ -505,6 +518,10 @@ int dap_chain_node_client_wait(dap_chain_node_client_t *a_client, int a_waited_s
pthread_mutex_unlock
(
&
a_client
->
wait_mutex
);
return
0
;
}
if
(
a_client
->
state
==
NODE_CLIENT_STATE_DISCONNECTED
)
{
pthread_mutex_unlock
(
&
a_client
->
wait_mutex
);
return
-
2
;
}
#ifndef _WIN32
// prepare for signal waiting
...
...
@@ -530,7 +547,7 @@ int dap_chain_node_client_wait(dap_chain_node_client_t *a_client, int a_waited_s
int
wait
=
pthread_cond_timedwait
(
&
a_client
->
wait_cond
,
&
a_client
->
wait_mutex
,
&
to
);
if
(
wait
==
0
&&
(
a_client
->
state
==
a_waited_state
||
a_client
->
state
==
NODE_CLIENT_STATE_ERROR
)
(
a_client
->
state
==
NODE_CLIENT_STATE_ERROR
||
a_client
->
state
==
NODE_CLIENT_STATE_DISCONNECTED
)
)
)
{
ret
=
a_client
->
state
==
a_waited_state
?
0
:
-
2
;
break
;
...
...
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