[polypaudio-commits] r646 - /trunk/src/modules/module-protocol-stub.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Thu Apr 6 16:52:49 PDT 2006
Author: lennart
Date: Fri Apr 7 01:52:48 2006
New Revision: 646
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=646&root=polypaudio&view=rev
Log:
* really pass the ipv6 socket server to protocol_new in case of ipv6.
* create the pa_modargs object properly when using TCP
* other cleanups
Modified:
trunk/src/modules/module-protocol-stub.c
Modified: trunk/src/modules/module-protocol-stub.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-protocol-stub.c?rev=646&root=polypaudio&r1=645&r2=646&view=diff
==============================================================================
--- trunk/src/modules/module-protocol-stub.c (original)
+++ trunk/src/modules/module-protocol-stub.c Fri Apr 7 01:52:48 2006
@@ -179,8 +179,7 @@
struct userdata *u = NULL;
#if defined(USE_TCP_SOCKETS)
- pa_socket_server *s_ipv4 = NULL;
- pa_socket_server *s_ipv6 = NULL;
+ pa_socket_server *s_ipv4 = NULL, *s_ipv6 = NULL;
int loopback = 1;
uint32_t port = IPV4_PORT;
const char *listen_on;
@@ -193,12 +192,12 @@
assert(c && m);
-#if defined(USE_TCP_SOCKETS)
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log(__FILE__": Failed to parse module arguments");
goto finish;
}
+#if defined(USE_TCP_SOCKETS)
if (pa_modargs_get_value_boolean(ma, "loopback", &loopback) < 0) {
pa_log(__FILE__": loopback= expects a boolean argument.");
goto fail;
@@ -214,19 +213,17 @@
if (listen_on) {
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);
- if (!s_ipv4 && !s_ipv6)
- goto fail;
} else if (loopback) {
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);
- if (!s_ipv4 && !s_ipv6)
- goto fail;
} else {
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);
- if (!s_ipv4 && !s_ipv6)
- goto fail;
- }
+ }
+
+ if (!s_ipv4 && !s_ipv6)
+ goto fail;
+
#else
v = pa_modargs_get_value(ma, "socket", UNIX_SOCKET);
assert(v);
@@ -250,20 +247,16 @@
goto fail;
#endif
- u = pa_xmalloc0(sizeof(struct userdata));
-
-#if defined(USE_TCP_SOCKETS)
- if (s_ipv4) {
- u->protocol_ipv4 = protocol_new(c, s_ipv4, m, ma);
- if (!u->protocol_ipv4)
+ u = pa_xnew0(struct userdata, 1);
+
+#if defined(USE_TCP_SOCKETS)
+ if (s_ipv4)
+ if (!(u->protocol_ipv4 = protocol_new(c, s_ipv4, m, ma)))
pa_socket_server_unref(s_ipv4);
- }
-
- if (s_ipv6) {
- u->protocol_ipv6 = protocol_new(c, s_ipv4, m, ma);
- if (!u->protocol_ipv6)
+
+ if (s_ipv6)
+ if (!(u->protocol_ipv6 = protocol_new(c, s_ipv6, m, ma)))
pa_socket_server_unref(s_ipv6);
- }
if (!u->protocol_ipv4 && !u->protocol_ipv6)
goto fail;
@@ -314,10 +307,10 @@
assert(c && m);
#if defined(USE_PROTOCOL_ESOUND) && !defined(USE_TCP_SOCKETS)
- if (remove(ESD_UNIX_SOCKET_NAME) != 0)
- pa_log("%s: Failed to remove %s : %s.", __FILE__, ESD_UNIX_SOCKET_NAME, strerror (errno));
- if (remove(ESD_UNIX_SOCKET_DIR) != 0)
- pa_log("%s: Failed to remove %s : %s.", __FILE__, ESD_UNIX_SOCKET_DIR, strerror (errno));
+ if (remove(ESD_UNIX_SOCKET_NAME) != 0)
+ pa_log("%s: Failed to remove %s : %s.", __FILE__, ESD_UNIX_SOCKET_NAME, strerror (errno));
+ if (remove(ESD_UNIX_SOCKET_DIR) != 0)
+ pa_log("%s: Failed to remove %s : %s.", __FILE__, ESD_UNIX_SOCKET_DIR, strerror (errno));
#endif
u = m->userdata;
More information about the pulseaudio-commits
mailing list