Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
87d72409
Commit
87d72409
authored
Jul 17, 2004
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix socket errors handling.
Fallback to IPv4 with option --ipv6 if IPv6 fails
parent
d16c1ff9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
src/misc/httpd.c
src/misc/httpd.c
+17
-11
No files found.
src/misc/httpd.c
View file @
87d72409
...
@@ -893,14 +893,13 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
...
@@ -893,14 +893,13 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
/* resolv */
/* resolv */
#ifdef HAVE_GETADDRINFO
#ifdef HAVE_GETADDRINFO
{
{
vlc_value_t
val
;
vlc_value_t
val
;
char
psz_port
[
6
];
char
psz_port
[
6
];
struct
addrinfo
hints
;
struct
addrinfo
hints
;
memset
(
&
hints
,
0
,
sizeof
(
hints
)
);
#if 0
#if 0
memset( &hints, 0, sizeof( hints ) );
/* Check if we have force ipv4 or ipv6 */
/* Check if we have force ipv4 or ipv6 */
var_Create( p_this, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_this, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_this, "ipv4", &val );
var_Get( p_this, "ipv4", &val );
...
@@ -915,12 +914,12 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
...
@@ -915,12 +914,12 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
*
*
*/
*/
hints
.
ai_family
=
PF_INET
;
hints
.
ai_family
=
PF_INET
;
#endif
var_Create
(
p_this
,
"ipv6"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_this
,
"ipv6"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_this
,
"ipv6"
,
&
val
);
var_Get
(
p_this
,
"ipv6"
,
&
val
);
if
(
val
.
b_bool
)
if
(
val
.
b_bool
)
hints
.
ai_family
=
PF_INET6
;
hints
.
ai_family
=
0
;
// try IPv6, then IPv4
#endif
hints
.
ai_socktype
=
SOCK_STREAM
;
hints
.
ai_socktype
=
SOCK_STREAM
;
hints
.
ai_flags
=
AI_PASSIVE
;
hints
.
ai_flags
=
AI_PASSIVE
;
...
@@ -1052,7 +1051,7 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
...
@@ -1052,7 +1051,7 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
/* create the listening socket */
/* create the listening socket */
fd
=
socket
(
res
->
ai_family
,
res
->
ai_socktype
,
res
->
ai_protocol
);
fd
=
socket
(
res
->
ai_family
,
res
->
ai_socktype
,
res
->
ai_protocol
);
if
(
fd
<
0
)
if
(
fd
==
-
1
)
continue
;
continue
;
/* reuse socket */
/* reuse socket */
...
@@ -1069,7 +1068,7 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
...
@@ -1069,7 +1068,7 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
if
(
bind
(
fd
,
res
->
ai_addr
,
res
->
ai_addrlen
)
)
if
(
bind
(
fd
,
res
->
ai_addr
,
res
->
ai_addrlen
)
)
{
{
msg_Err
(
p_this
,
"cannot bind socket"
);
msg_Err
(
p_this
,
"cannot bind socket"
);
continue
;
goto
socket_error
;
}
}
/* set to non-blocking */
/* set to non-blocking */
#if defined( WIN32 ) || defined( UNDER_CE )
#if defined( WIN32 ) || defined( UNDER_CE )
...
@@ -1078,7 +1077,7 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
...
@@ -1078,7 +1077,7 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
if
(
ioctlsocket
(
fd
,
FIONBIO
,
&
i_dummy
)
!=
0
)
if
(
ioctlsocket
(
fd
,
FIONBIO
,
&
i_dummy
)
!=
0
)
{
{
msg_Err
(
p_this
,
"cannot set socket to non-blocking mode"
);
msg_Err
(
p_this
,
"cannot set socket to non-blocking mode"
);
continue
;
goto
socket_error
;
}
}
}
}
#else
#else
...
@@ -1087,12 +1086,12 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
...
@@ -1087,12 +1086,12 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
if
(
(
i_flags
=
fcntl
(
fd
,
F_GETFL
,
0
)
)
<
0
)
if
(
(
i_flags
=
fcntl
(
fd
,
F_GETFL
,
0
)
)
<
0
)
{
{
msg_Err
(
p_this
,
"cannot F_GETFL socket"
);
msg_Err
(
p_this
,
"cannot F_GETFL socket"
);
continue
;
goto
socket_error
;
}
}
if
(
fcntl
(
fd
,
F_SETFL
,
i_flags
|
O_NONBLOCK
)
<
0
)
if
(
fcntl
(
fd
,
F_SETFL
,
i_flags
|
O_NONBLOCK
)
<
0
)
{
{
msg_Err
(
p_this
,
"cannot F_SETFL O_NONBLOCK"
);
msg_Err
(
p_this
,
"cannot F_SETFL O_NONBLOCK"
);
continue
;
goto
socket_error
;
}
}
}
}
#endif
#endif
...
@@ -1100,8 +1099,15 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
...
@@ -1100,8 +1099,15 @@ httpd_host_t *httpd_HostNew( vlc_object_t *p_this, char *psz_host, int i_port )
if
(
listen
(
fd
,
LISTEN_BACKLOG
)
<
0
)
if
(
listen
(
fd
,
LISTEN_BACKLOG
)
<
0
)
{
{
msg_Err
(
p_this
,
"cannot listen socket"
);
msg_Err
(
p_this
,
"cannot listen socket"
);
continue
;
close
(
fd
);
fd
=
-
1
;
}
}
continue
;
socket_error:
close
(
fd
);
fd
=
-
1
;
}
}
freeaddrinfo
(
res
);
freeaddrinfo
(
res
);
...
...
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