Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
97fad33a
Commit
97fad33a
authored
Sep 11, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve socket polling logic so that errors to avoid silencing errors.
parent
99e3e5ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
src/network/io.c
src/network/io.c
+16
-9
No files found.
src/network/io.c
View file @
97fad33a
...
...
@@ -140,7 +140,7 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
uint8_t
*
restrict
buf
,
size_t
buflen
,
int
wait_ms
,
vlc_bool_t
waitall
)
{
in
t
total
=
0
;
size_
t
total
=
0
;
do
{
...
...
@@ -171,6 +171,10 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
assert
((
unsigned
)
n
<=
fdc
);
for
(
int
i
=
0
;
n
>
0
;
i
++
)
{
if
((
total
>
0
)
&&
(
ufd
[
i
].
revents
&
POLLERR
))
return
total
;
// error will be dequeued on next run
if
(
ufd
[
i
].
revents
)
{
fdc
=
1
;
...
...
@@ -179,6 +183,7 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
n
--
;
goto
receive
;
}
}
#else
int
maxfd
=
-
1
;
fd_set
set
;
...
...
@@ -272,7 +277,7 @@ receive:
error:
msg_Err
(
p_this
,
"Read error: %s"
,
net_strerror
(
net_errno
));
return
total
?:
-
1
;
return
total
?
(
int
)
total
:
-
1
;
}
...
...
@@ -337,12 +342,12 @@ int __net_Select( vlc_object_t *restrict p_this, const int *restrict pi_fd,
int
__net_Write
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
p_vs
,
const
uint8_t
*
p_data
,
int
i_data
)
{
int
i_
total
=
0
;
size_t
total
=
0
;
while
(
i_data
>
0
)
{
if
(
p_this
->
b_die
)
return
i_
total
;
return
total
;
#ifdef HAVE_POLL
struct
pollfd
ufd
[
1
];
...
...
@@ -351,6 +356,8 @@ int __net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
ufd
[
0
].
events
=
POLLOUT
;
int
val
=
poll
(
ufd
,
1
,
500
);
if
((
val
>
0
)
&&
(
ufd
[
0
].
revents
&
POLLERR
)
&&
(
total
>
0
))
return
total
;
// error will be dequeued separately on next call
#else
fd_set
set
;
FD_ZERO
(
&
set
);
...
...
@@ -375,7 +382,7 @@ int __net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
{
msg_Err
(
p_this
,
"Write error: %s"
,
net_strerror
(
net_errno
));
return
i_total
?
:
-
1
;
return
total
?
(
int
)
total
:
-
1
;
}
case
0
:
...
...
@@ -392,16 +399,16 @@ int __net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
#endif
if
(
val
==
-
1
)
return
i_total
?
:
-
1
;
return
total
?
(
int
)
total
:
-
1
;
if
(
val
==
0
)
return
i_
total
;
return
total
;
p_data
+=
val
;
i_data
-=
val
;
i_
total
+=
val
;
total
+=
val
;
}
return
i_
total
;
return
total
;
}
char
*
__net_Gets
(
vlc_object_t
*
p_this
,
int
fd
,
const
v_socket_t
*
p_vs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment