Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
7db465a8
Commit
7db465a8
authored
Dec 07, 2005
by
Rémi Denis-Courmont
Browse files
Work around for awfully broken Win32 DNS resolver - closes #445
parent
f970744f
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/services_discovery/sap.c
View file @
7db465a8
...
...
@@ -279,7 +279,6 @@ static int Open( vlc_object_t *p_this )
malloc
(
sizeof
(
services_discovery_sys_t
)
);
playlist_view_t
*
p_view
;
char
*
psz_addr
;
vlc_value_t
val
;
p_sys
->
i_timeout
=
var_CreateGetInteger
(
p_sd
,
"sap-timeout"
);
...
...
@@ -298,37 +297,6 @@ static int Open( vlc_object_t *p_this )
CacheLoad
(
p_sd
);
}
if
(
var_CreateGetInteger
(
p_sd
,
"sap-ipv4"
)
)
{
InitSocket
(
p_sd
,
SAP_V4_GLOBAL_ADDRESS
,
SAP_PORT
);
InitSocket
(
p_sd
,
SAP_V4_ORG_ADDRESS
,
SAP_PORT
);
InitSocket
(
p_sd
,
SAP_V4_LOCAL_ADDRESS
,
SAP_PORT
);
InitSocket
(
p_sd
,
SAP_V4_LINK_ADDRESS
,
SAP_PORT
);
}
if
(
var_CreateGetInteger
(
p_sd
,
"sap-ipv6"
)
)
{
char
psz_address
[]
=
SAP_V6_1
"0"
SAP_V6_2
;
const
char
*
c_scope
;
for
(
c_scope
=
ipv6_scopes
;
*
c_scope
;
c_scope
++
)
{
psz_address
[
sizeof
(
SAP_V6_1
)
-
1
]
=
*
c_scope
;
InitSocket
(
p_sd
,
psz_address
,
SAP_PORT
);
}
}
psz_addr
=
var_CreateGetString
(
p_sd
,
"sap-addr"
);
if
(
psz_addr
&&
*
psz_addr
)
{
InitSocket
(
p_sd
,
psz_addr
,
SAP_PORT
);
}
if
(
p_sys
->
i_fd
==
0
)
{
msg_Err
(
p_sd
,
"unable to read on any address"
);
return
VLC_EGENERIC
;
}
/* Cache sap_timeshift value */
p_sys
->
b_timeshift
=
var_CreateGetInteger
(
p_sd
,
"sap-timeshift"
)
?
VLC_TRUE
:
VLC_FALSE
;
...
...
@@ -507,8 +475,46 @@ static void CloseDemux( vlc_object_t *p_this )
static
void
Run
(
services_discovery_t
*
p_sd
)
{
char
*
psz_addr
;
int
i
;
/* Braindead Winsock DNS resolver will get stuck over 2 seconds per failed
* DNS queries, even if the DNS server returns an error with milliseconds.
* You don't want to know why the bug (as of XP SP2) wasn't fixed since
* Winsock 1.1 from Windows 95, if not Windows 3.1.
* Anyway, to avoid a 30 seconds delay for failed IPv6 socket creation,
* we have to open sockets in Run() rather than Open(). */
if
(
var_CreateGetInteger
(
p_sd
,
"sap-ipv4"
)
)
{
InitSocket
(
p_sd
,
SAP_V4_GLOBAL_ADDRESS
,
SAP_PORT
);
InitSocket
(
p_sd
,
SAP_V4_ORG_ADDRESS
,
SAP_PORT
);
InitSocket
(
p_sd
,
SAP_V4_LOCAL_ADDRESS
,
SAP_PORT
);
InitSocket
(
p_sd
,
SAP_V4_LINK_ADDRESS
,
SAP_PORT
);
}
if
(
var_CreateGetInteger
(
p_sd
,
"sap-ipv6"
)
)
{
char
psz_address
[]
=
SAP_V6_1
"0"
SAP_V6_2
;
const
char
*
c_scope
;
for
(
c_scope
=
ipv6_scopes
;
*
c_scope
;
c_scope
++
)
{
psz_address
[
sizeof
(
SAP_V6_1
)
-
1
]
=
*
c_scope
;
InitSocket
(
p_sd
,
psz_address
,
SAP_PORT
);
}
}
psz_addr
=
var_CreateGetString
(
p_sd
,
"sap-addr"
);
if
(
psz_addr
&&
*
psz_addr
)
{
InitSocket
(
p_sd
,
psz_addr
,
SAP_PORT
);
}
if
(
p_sd
->
p_sys
->
i_fd
==
0
)
{
msg_Err
(
p_sd
,
"unable to listen on any address"
);
return
;
}
/* read SAP packets */
while
(
!
p_sd
->
b_die
)
{
...
...
@@ -1234,7 +1240,7 @@ static sdp_t * ParseSDP( vlc_object_t *p_obj, char* psz_sdp )
static
int
InitSocket
(
services_discovery_t
*
p_sd
,
char
*
psz_address
,
int
i_port
)
{
int
i_fd
=
net_OpenUDP
(
p_sd
,
psz_address
,
i_port
,
""
,
0
);
int
i_fd
=
net_OpenUDP
(
p_sd
,
psz_address
,
i_port
,
NULL
,
0
);
if
(
i_fd
!=
-
1
)
{
...
...
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