Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
6b382b4b
Commit
6b382b4b
authored
Feb 15, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fix error reporting in net_Read* (refs #1056)
- Suppress broken and unused timeout value from net_ReadNonBlock()
parent
442bc8bb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
15 deletions
+21
-15
modules/stream_out/switcher.c
modules/stream_out/switcher.c
+1
-1
src/network/io.c
src/network/io.c
+19
-13
src/stream_output/sap.c
src/stream_output/sap.c
+1
-1
No files found.
modules/stream_out/switcher.c
View file @
6b382b4b
...
@@ -651,7 +651,7 @@ static void NetCommand( sout_stream_t *p_stream )
...
@@ -651,7 +651,7 @@ static void NetCommand( sout_stream_t *p_stream )
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
char
psz_buffer
[
11
];
char
psz_buffer
[
11
];
int
i_len
=
net_ReadNonBlock
(
p_stream
,
p_sys
->
i_fd
,
NULL
,
(
uint8_t
*
)
&
psz_buffer
[
0
],
int
i_len
=
net_ReadNonBlock
(
p_stream
,
p_sys
->
i_fd
,
NULL
,
(
uint8_t
*
)
&
psz_buffer
[
0
],
sizeof
(
psz_buffer
)
-
1
,
0
);
sizeof
(
psz_buffer
)
-
1
);
if
(
i_len
>
0
)
if
(
i_len
>
0
)
{
{
...
...
src/network/io.c
View file @
6b382b4b
...
@@ -359,26 +359,30 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
...
@@ -359,26 +359,30 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
* with the first part of the datagram. */
* with the first part of the datagram. */
msg_Err
(
p_this
,
"Receive error: "
msg_Err
(
p_this
,
"Receive error: "
"Increase the mtu size (--mtu option)"
);
"Increase the mtu size (--mtu option)"
);
i_total
+=
i_buflen
;
n
=
i_buflen
;
return
i_total
;
break
;
default:
goto
error
;
}
}
#else
#else
if
(
errno
==
EAGAIN
)
/* spurious wake-up (sucks if fdc > 1) */
if
(
errno
==
EAGAIN
)
/* spurious wake-up (sucks if fdc > 1) */
continue
;
continue
;
#endif
goto
error
;
goto
error
;
#endif
}
}
if
(
n
==
0
)
// EOF
if
(
n
==
0
)
// EOF
return
i_total
;
break
;
i_total
+=
n
;
i_total
+=
n
;
p_buf
+=
n
;
p_buf
+=
n
;
i_buflen
-=
n
;
i_buflen
-=
n
;
if
(
!
waitall
)
if
(
!
waitall
)
return
i_total
;
break
;
/* FIXME: This is broken. Do not us this. */
if
(
wait_ms
!=
-
1
)
if
(
wait_ms
!=
-
1
)
{
{
wait_ms
-=
delay_ms
;
wait_ms
-=
delay_ms
;
...
@@ -389,7 +393,6 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
...
@@ -389,7 +393,6 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
return
i_total
;
return
i_total
;
error:
error:
if
(
errno
!=
EINTR
)
msg_Err
(
p_this
,
"Read error: %s"
,
net_strerror
(
net_errno
)
);
msg_Err
(
p_this
,
"Read error: %s"
,
net_strerror
(
net_errno
)
);
return
i_total
?
(
ssize_t
)
i_total
:
-
1
;
return
i_total
?
(
ssize_t
)
i_total
:
-
1
;
}
}
...
@@ -400,30 +403,32 @@ error:
...
@@ -400,30 +403,32 @@ error:
*****************************************************************************
*****************************************************************************
* Read from a network socket
* Read from a network socket
* If b_retry is true, then we repeat until we have read the right amount of
* If b_retry is true, then we repeat until we have read the right amount of
* data
* data
; in that case, a short count means EOF has been reached.
*****************************************************************************/
*****************************************************************************/
ssize_t
__net_Read
(
vlc_object_t
*
restrict
p_this
,
int
fd
,
ssize_t
__net_Read
(
vlc_object_t
*
restrict
p_this
,
int
fd
,
const
v_socket_t
*
restrict
p_vs
,
const
v_socket_t
*
restrict
p_vs
,
uint8_t
*
restrict
buf
,
size_t
len
,
vlc_bool_t
b_retry
)
uint8_t
*
restrict
buf
,
size_t
len
,
vlc_bool_t
b_retry
)
{
{
return
net_ReadInner
(
p_this
,
1
,
&
(
int
){
fd
},
return
net_ReadInner
(
p_this
,
1
,
&
(
int
){
fd
},
&
(
const
v_socket_t
*
){
p_vs
},
buf
,
len
,
-
1
,
&
(
const
v_socket_t
*
){
p_vs
},
b_retry
);
b
uf
,
len
,
-
1
,
b
_retry
);
}
}
/*****************************************************************************
/*****************************************************************************
* __net_ReadNonBlock:
* __net_ReadNonBlock:
*****************************************************************************
*****************************************************************************
* Read from a network socket, non blocking mode (with timeout)
* Read from a network socket, non blocking mode.
* This function should only be used after a poll() (or select(), but you
* should use poll instead of select()) invocation to avoid busy loops.
*****************************************************************************/
*****************************************************************************/
ssize_t
__net_ReadNonBlock
(
vlc_object_t
*
restrict
p_this
,
int
fd
,
ssize_t
__net_ReadNonBlock
(
vlc_object_t
*
restrict
p_this
,
int
fd
,
const
v_socket_t
*
restrict
p_vs
,
const
v_socket_t
*
restrict
p_vs
,
uint8_t
*
restrict
buf
,
size_t
len
,
mtime_t
i_wait
)
uint8_t
*
restrict
buf
,
size_t
len
)
{
{
return
net_ReadInner
(
p_this
,
1
,
&
(
int
){
fd
},
return
net_ReadInner
(
p_this
,
1
,
&
(
int
){
fd
},
&
(
const
v_socket_t
*
){
p_vs
},
&
(
const
v_socket_t
*
){
p_vs
},
buf
,
len
,
i_wait
/
100
0
,
VLC_FALSE
);
buf
,
len
,
0
,
VLC_FALSE
);
}
}
...
@@ -432,6 +437,7 @@ ssize_t __net_ReadNonBlock( vlc_object_t *restrict p_this, int fd,
...
@@ -432,6 +437,7 @@ ssize_t __net_ReadNonBlock( vlc_object_t *restrict p_this, int fd,
*****************************************************************************
*****************************************************************************
* Read from several sockets (with timeout). Takes data from the first socket
* Read from several sockets (with timeout). Takes data from the first socket
* that has some.
* that has some.
* NOTE: DO NOT USE this API with a non-zero delay. You were warned.
*****************************************************************************/
*****************************************************************************/
ssize_t
__net_Select
(
vlc_object_t
*
restrict
p_this
,
ssize_t
__net_Select
(
vlc_object_t
*
restrict
p_this
,
const
int
*
restrict
fds
,
int
nfd
,
const
int
*
restrict
fds
,
int
nfd
,
...
...
src/stream_output/sap.c
View file @
6b382b4b
...
@@ -653,7 +653,7 @@ static int CalculateRate( sap_handler_t *p_sap, sap_address_t *p_address )
...
@@ -653,7 +653,7 @@ static int CalculateRate( sap_handler_t *p_sap, sap_address_t *p_address )
{
{
/* Might be too slow if we have huge data */
/* Might be too slow if we have huge data */
i_read
=
net_ReadNonBlock
(
p_sap
,
p_address
->
i_rfd
,
NULL
,
buffer
,
i_read
=
net_ReadNonBlock
(
p_sap
,
p_address
->
i_rfd
,
NULL
,
buffer
,
SAP_MAX_BUFFER
,
0
);
SAP_MAX_BUFFER
);
i_tot
+=
i_read
;
i_tot
+=
i_read
;
}
while
(
i_read
>
0
);
}
while
(
i_read
>
0
);
...
...
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