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
6eeb0d16
Commit
6eeb0d16
authored
Jun 23, 2005
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fix infinite loop on TCP connection timeout
- Really obey the ipv4-timeout to the ms
parent
2a5f4e0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
13 deletions
+24
-13
src/misc/net.c
src/misc/net.c
+24
-13
No files found.
src/misc/net.c
View file @
6eeb0d16
...
...
@@ -185,11 +185,10 @@ int __net_OpenTCP( vlc_object_t *p_this, const char *psz_host, int i_port )
if
(
connect
(
fd
,
ptr
->
ai_addr
,
ptr
->
ai_addrlen
)
)
{
int
i_val_size
=
sizeof
(
i_val
),
i_max_count
;
int
i_val_size
=
sizeof
(
i_val
);
div_t
d
;
struct
timeval
tv
;
vlc_value_t
timeout
;
fd_set
fds
;
#if defined( WIN32 ) || defined( UNDER_CE )
if
(
WSAGetLastError
()
!=
WSAEWOULDBLOCK
)
{
...
...
@@ -211,11 +210,18 @@ int __net_OpenTCP( vlc_object_t *p_this, const char *psz_host, int i_port )
var_Create
(
p_this
,
"ipv4-timeout"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_this
,
"ipv4-timeout"
,
&
timeout
);
i_max_count
=
timeout
.
i_int
/
100
;
if
(
timeout
.
i_int
<
0
)
{
msg_Err
(
p_this
,
"invalid negative value for ipv4-timeout"
);
timeout
.
i_int
=
0
;
}
d
=
div
(
timeout
.
i_int
,
100
);
msg_Dbg
(
p_this
,
"connection in progress"
);
do
{
fd_set
fds
;
if
(
p_this
->
b_die
)
{
msg_Dbg
(
p_this
,
"connection aborted"
);
...
...
@@ -224,14 +230,6 @@ int __net_OpenTCP( vlc_object_t *p_this, const char *psz_host, int i_port )
free
(
psz_socks
);
return
-
1
;
}
if
(
i_max_count
<=
0
)
{
msg_Dbg
(
p_this
,
"connection timed out"
);
net_Close
(
fd
);
continue
;
}
i_max_count
--
;
/* Initialize file descriptor set */
FD_ZERO
(
&
fds
);
...
...
@@ -239,9 +237,19 @@ int __net_OpenTCP( vlc_object_t *p_this, const char *psz_host, int i_port )
/* We'll wait 0.1 second if nothing happens */
tv
.
tv_sec
=
0
;
tv
.
tv_usec
=
100000
;
tv
.
tv_usec
=
(
d
.
quot
>
0
)
?
100000
:
(
1000
*
d
.
rem
)
;
i_val
=
select
(
fd
+
1
,
NULL
,
&
fds
,
NULL
,
&
tv
);
if
(
d
.
quot
<=
0
)
{
msg_Dbg
(
p_this
,
"connection timed out"
);
net_Close
(
fd
);
fd
=
-
1
;
break
;
}
d
.
quot
--
;
}
while
(
(
i_val
==
0
)
||
(
(
i_val
<
0
)
&&
#if defined( WIN32 ) || defined( UNDER_CE )
...
...
@@ -251,6 +259,9 @@ int __net_OpenTCP( vlc_object_t *p_this, const char *psz_host, int i_port )
#endif
)
);
if
(
fd
==
-
1
)
continue
;
/* timeout */
if
(
i_val
<
0
)
{
msg_Warn
(
p_this
,
"connection aborted (select failed)"
);
...
...
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