mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
* really pass the ipv6 socket server to protocol_new in case of ipv6.
* create the pa_modargs object properly when using TCP * other cleanups git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@646 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
1be00173c1
commit
dd9605ba1f
1 changed files with 15 additions and 22 deletions
|
|
@ -179,8 +179,7 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
struct userdata *u = NULL;
|
struct userdata *u = NULL;
|
||||||
|
|
||||||
#if defined(USE_TCP_SOCKETS)
|
#if defined(USE_TCP_SOCKETS)
|
||||||
pa_socket_server *s_ipv4 = NULL;
|
pa_socket_server *s_ipv4 = NULL, *s_ipv6 = NULL;
|
||||||
pa_socket_server *s_ipv6 = NULL;
|
|
||||||
int loopback = 1;
|
int loopback = 1;
|
||||||
uint32_t port = IPV4_PORT;
|
uint32_t port = IPV4_PORT;
|
||||||
const char *listen_on;
|
const char *listen_on;
|
||||||
|
|
@ -193,12 +192,12 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
|
|
||||||
assert(c && m);
|
assert(c && m);
|
||||||
|
|
||||||
#if defined(USE_TCP_SOCKETS)
|
|
||||||
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
|
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
|
||||||
pa_log(__FILE__": Failed to parse module arguments");
|
pa_log(__FILE__": Failed to parse module arguments");
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(USE_TCP_SOCKETS)
|
||||||
if (pa_modargs_get_value_boolean(ma, "loopback", &loopback) < 0) {
|
if (pa_modargs_get_value_boolean(ma, "loopback", &loopback) < 0) {
|
||||||
pa_log(__FILE__": loopback= expects a boolean argument.");
|
pa_log(__FILE__": loopback= expects a boolean argument.");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -214,19 +213,17 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
if (listen_on) {
|
if (listen_on) {
|
||||||
s_ipv4 = pa_socket_server_new_ipv4_string(c->mainloop, listen_on, port, TCPWRAP_SERVICE);
|
s_ipv4 = pa_socket_server_new_ipv4_string(c->mainloop, listen_on, port, TCPWRAP_SERVICE);
|
||||||
s_ipv6 = pa_socket_server_new_ipv6_string(c->mainloop, listen_on, port, TCPWRAP_SERVICE);
|
s_ipv6 = pa_socket_server_new_ipv6_string(c->mainloop, listen_on, port, TCPWRAP_SERVICE);
|
||||||
if (!s_ipv4 && !s_ipv6)
|
|
||||||
goto fail;
|
|
||||||
} else if (loopback) {
|
} else if (loopback) {
|
||||||
s_ipv4 = pa_socket_server_new_ipv4_loopback(c->mainloop, port, TCPWRAP_SERVICE);
|
s_ipv4 = pa_socket_server_new_ipv4_loopback(c->mainloop, port, TCPWRAP_SERVICE);
|
||||||
s_ipv6 = pa_socket_server_new_ipv6_loopback(c->mainloop, port, TCPWRAP_SERVICE);
|
s_ipv6 = pa_socket_server_new_ipv6_loopback(c->mainloop, port, TCPWRAP_SERVICE);
|
||||||
if (!s_ipv4 && !s_ipv6)
|
|
||||||
goto fail;
|
|
||||||
} else {
|
} else {
|
||||||
s_ipv4 = pa_socket_server_new_ipv4_any(c->mainloop, port, TCPWRAP_SERVICE);
|
s_ipv4 = pa_socket_server_new_ipv4_any(c->mainloop, port, TCPWRAP_SERVICE);
|
||||||
s_ipv6 = pa_socket_server_new_ipv6_any(c->mainloop, port, TCPWRAP_SERVICE);
|
s_ipv6 = pa_socket_server_new_ipv6_any(c->mainloop, port, TCPWRAP_SERVICE);
|
||||||
|
}
|
||||||
|
|
||||||
if (!s_ipv4 && !s_ipv6)
|
if (!s_ipv4 && !s_ipv6)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
v = pa_modargs_get_value(ma, "socket", UNIX_SOCKET);
|
v = pa_modargs_get_value(ma, "socket", UNIX_SOCKET);
|
||||||
assert(v);
|
assert(v);
|
||||||
|
|
@ -250,20 +247,16 @@ int pa__init(pa_core *c, pa_module*m) {
|
||||||
goto fail;
|
goto fail;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u = pa_xmalloc0(sizeof(struct userdata));
|
u = pa_xnew0(struct userdata, 1);
|
||||||
|
|
||||||
#if defined(USE_TCP_SOCKETS)
|
#if defined(USE_TCP_SOCKETS)
|
||||||
if (s_ipv4) {
|
if (s_ipv4)
|
||||||
u->protocol_ipv4 = protocol_new(c, s_ipv4, m, ma);
|
if (!(u->protocol_ipv4 = protocol_new(c, s_ipv4, m, ma)))
|
||||||
if (!u->protocol_ipv4)
|
|
||||||
pa_socket_server_unref(s_ipv4);
|
pa_socket_server_unref(s_ipv4);
|
||||||
}
|
|
||||||
|
|
||||||
if (s_ipv6) {
|
if (s_ipv6)
|
||||||
u->protocol_ipv6 = protocol_new(c, s_ipv4, m, ma);
|
if (!(u->protocol_ipv6 = protocol_new(c, s_ipv6, m, ma)))
|
||||||
if (!u->protocol_ipv6)
|
|
||||||
pa_socket_server_unref(s_ipv6);
|
pa_socket_server_unref(s_ipv6);
|
||||||
}
|
|
||||||
|
|
||||||
if (!u->protocol_ipv4 && !u->protocol_ipv6)
|
if (!u->protocol_ipv4 && !u->protocol_ipv6)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue