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
4856581f
Commit
4856581f
authored
11 months ago
by
Alessio Igor Bogani
Browse files
Options
Downloads
Patches
Plain Diff
Fix indentation
parent
a6d807b9
No related branches found
Branches containing commit
Tags
2.0.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
+36
-36
36 additions, 36 deletions
src/Socket2.cpp
with
36 additions
and
36 deletions
src/Socket2.cpp
+
36
−
36
View file @
4856581f
...
...
@@ -510,9 +510,9 @@ void Socket2::write(const Tango::DevVarCharArray *argin)
int
s
=
select
(
WRITE
);
if
(
s
==
0
)
goto
timeout
;
else
if
(
s
<
0
)
goto
error
;
else
{
/* s > 0 */
}
else
if
(
s
<
0
)
goto
error
;
else
{
/* s > 0 */
}
ssize_t
bytes_written
=
_write
(
fd
,
argin_data
.
data
()
+
bytes_total
,
...
...
@@ -760,40 +760,40 @@ ssize_t Socket2::_write(int fd, const void *buf, size_t count)
void
Socket2
::
_read
(
size_t
bytes_to_read
)
{
unsigned
char
buffer
[
10000
];
size_t
bytes_total
=
data
.
size
();
unsigned
char
buffer
[
10000
];
size_t
bytes_total
=
data
.
size
();
while
(
bytes_total
<
bytes_to_read
)
{
while
(
bytes_total
<
bytes_to_read
)
{
int
s
=
select
(
READ
);
if
(
s
==
0
)
goto
timeout
;
else
if
(
s
<
0
)
goto
error
;
else
{
/* s > 0 */
}
size_t
count
=
min
((
size_t
)
max
(
input_queue_length
(),
0
),
sizeof
(
buffer
));
ssize_t
bytes_readed
=
proto
==
UDP
?
::
recvfrom
(
fd
,
buffer
,
count
,
0
,
(
sockaddr
*
)
&
sa
,
&
sa_len
)
:
::
read
(
fd
,
buffer
,
count
);
if
(
bytes_readed
>
0
)
{
data
.
insert
(
data
.
end
(),
&
buffer
[
0
],
&
buffer
[
bytes_readed
]);
bytes_total
+=
bytes_readed
;
}
else
if
(
bytes_readed
==
0
)
{
if
(
multiplexing
==
SELECT
)
goto
error
;
/* Continue if multiplexing == SLEEP */
}
else
{
/* bytes_readed < 0 */
goto
error
;
}
}
return
;
else
if
(
s
<
0
)
goto
error
;
else
{
/* s > 0 */
}
size_t
count
=
min
((
size_t
)
max
(
input_queue_length
(),
0
),
sizeof
(
buffer
));
ssize_t
bytes_readed
=
proto
==
UDP
?
::
recvfrom
(
fd
,
buffer
,
count
,
0
,
(
sockaddr
*
)
&
sa
,
&
sa_len
)
:
::
read
(
fd
,
buffer
,
count
);
if
(
bytes_readed
>
0
)
{
data
.
insert
(
data
.
end
(),
&
buffer
[
0
],
&
buffer
[
bytes_readed
]);
bytes_total
+=
bytes_readed
;
}
else
if
(
bytes_readed
==
0
)
{
if
(
multiplexing
==
SELECT
)
goto
error
;
/* Continue if multiplexing == SLEEP */
}
else
{
/* bytes_readed < 0 */
goto
error
;
}
}
return
;
error
:
check_state
(
true
);
sleep
(
tout
);
check_state
(
true
);
sleep
(
tout
);
timeout
:
Tango
::
Except
::
throw_exception
(
""
,
"Timeout expired"
,
__PRETTY_FUNCTION__
);
Tango
::
Except
::
throw_exception
(
""
,
"Timeout expired"
,
__PRETTY_FUNCTION__
);
}
void
Socket2
::
check_state
(
bool
forcing
)
...
...
@@ -874,7 +874,7 @@ int Socket2::select(event_type et)
FD_ZERO
(
&
readfds
);
FD_ZERO
(
&
writefds
);
FD_SET
(
fd
,
&
errorfds
);
FD_SET
(
fd
,
&
errorfds
);
switch
(
et
)
{
case
WRITE
:
FD_SET
(
fd
,
&
writefds
);
...
...
@@ -887,10 +887,10 @@ int Socket2::select(event_type et)
int
select_ret
=
::
select
(
fd
+
1
,
&
readfds
,
&
writefds
,
&
errorfds
,
&
tout
);
if
(
FD_ISSET
(
fd
,
&
errorfds
))
{
assert
(
false
);
return
-
1
;
}
if
(
FD_ISSET
(
fd
,
&
errorfds
))
{
assert
(
false
);
return
-
1
;
}
if
(
select_ret
>
0
)
{
if
(
et
==
READ
&&
FD_ISSET
(
fd
,
&
readfds
))
...
...
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