Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
socket2
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs
ds
socket2
Commits
45ebc2eb
Commit
45ebc2eb
authored
1 year ago
by
Alessio Igor Bogani
Browse files
Options
Downloads
Patches
Plain Diff
Add a sleep if write() fails immediately
parent
18270fec
No related branches found
Branches containing commit
Tags
1.2.0
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Socket2.cpp
+14
-6
14 additions, 6 deletions
src/Socket2.cpp
with
14 additions
and
6 deletions
src/Socket2.cpp
+
14
−
6
View file @
45ebc2eb
...
...
@@ -532,14 +532,19 @@ void Socket2::write(const Tango::DevVarCharArray *argin)
{
delete
argin_data
;
string
error_mesg
=
"Connection refused"
;
close
();
open
();
string
error_mesg
=
"Connection refused"
;
DEBUG_STREAM
<<
error_mesg
<<
endl
;
set_state
(
Tango
::
FAULT
);
set_status
(
error_mesg
);
sleep
(
tout
.
tv_sec
);
usleep
(
tout
.
tv_usec
);
timerclear
(
&
tout
);
Tango
::
Except
::
throw_exception
(
""
,
error_mesg
,
"Socket2::write()"
);
...
...
@@ -586,11 +591,12 @@ void Socket2::write(const Tango::DevVarCharArray *argin)
if
(
(
bytes_total
-
output_queue_length
())
!=
bytes_to_write
)
{
string
error_mesg
=
"Unable to send request to device"
;
close
();
open
();
string
error_mesg
=
"Unable to send request to device"
;
DEBUG_STREAM
<<
error_mesg
<<
endl
;
set_state
(
Tango
::
FAULT
);
set_status
(
error_mesg
);
...
...
@@ -997,9 +1003,11 @@ bool Socket2::read(timeval *tv)
close
();
open
();
DEBUG_STREAM
<<
"Server shutting down"
<<
endl
;
string
error_mesg
=
"Server shutting down"
;
DEBUG_STREAM
<<
error_mesg
<<
endl
;
set_state
(
Tango
::
FAULT
);
set_status
(
"Server shutting down"
);
set_status
(
error_mesg
);
sleep
(
tv
->
tv_sec
);
usleep
(
tv
->
tv_usec
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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