mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
Fallbacks for systems that do not have getaddrinfo(). Does not handle
IPv6 though. git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/ossman@369 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
3f2ac7eb8c
commit
70223bac46
3 changed files with 37 additions and 5 deletions
|
|
@ -426,8 +426,9 @@ struct pa_socket_client* pa_socket_client_new_string(struct pa_mainloop_api *m,
|
|||
assert(c->asyncns_query);
|
||||
start_timeout(c);
|
||||
}
|
||||
#else
|
||||
#else /* HAVE_LIBASYNCNS */
|
||||
{
|
||||
#ifdef HAVE_GETADDRINFO
|
||||
int ret;
|
||||
struct addrinfo *res = NULL;
|
||||
|
||||
|
|
@ -438,12 +439,37 @@ struct pa_socket_client* pa_socket_client_new_string(struct pa_mainloop_api *m,
|
|||
|
||||
if (res->ai_addr) {
|
||||
if ((c = pa_socket_client_new_sockaddr(m, res->ai_addr, res->ai_addrlen)))
|
||||
start_timeout(c);
|
||||
start_timeout(c);
|
||||
}
|
||||
|
||||
freeaddrinfo(res);
|
||||
#else /* HAVE_GETADDRINFO */
|
||||
struct hostent *host = NULL;
|
||||
struct sockaddr_in s;
|
||||
|
||||
/* FIXME: PF_INET6 support */
|
||||
if (hints.ai_family != PF_INET)
|
||||
goto finish;
|
||||
|
||||
host = gethostbyname(a.path_or_host);
|
||||
if (!host) {
|
||||
unsigned int addr = inet_addr(a.path_or_host);
|
||||
if (addr != INADDR_NONE)
|
||||
host = gethostbyaddr((char*)&addr, 4, AF_INET);
|
||||
}
|
||||
|
||||
if (!host)
|
||||
goto finish;
|
||||
|
||||
s.sin_family = AF_INET;
|
||||
memcpy(&s.sin_addr, host->h_addr, sizeof(struct in_addr));
|
||||
s.sin_port = port;
|
||||
|
||||
if ((c = pa_socket_client_new_sockaddr(m, &s, sizeof(s))))
|
||||
start_timeout(c);
|
||||
#endif /* HAVE_GETADDRINFO */
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_LIBASYNCNS */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue