protocol-stub: Don't query FQDN when loading module-native-protocol-tcp 84/27084/1
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Thu, 4 Sep 2014 08:39:30 +0000 (11:39 +0300)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Thu, 4 Sep 2014 08:39:30 +0000 (11:39 +0300)
This works around the issue that in some environments it takes 10
seconds to start PulseAudio, because the network is not responding to
our FQDN queries.

A side effect of this is that we don't register the server address in
the native protocol, so things that use the address registry don't
work. Currently this affects module-zeroconf-publish and
module-bonjour-publish. The assumption is that Tizen doesn't need
either of those.

This patch is not upstreamable. To get rid of this patch, someone
needs to fix https://bugs.freedesktop.org/show_bug.cgi?id=81802

Change-Id: I38a2e2676bd4ea3fe8c54a4c0f712fa7c3c5e115

src/modules/module-protocol-stub.c

index 3218a01..15a6b91 100644 (file)
@@ -245,7 +245,7 @@ int pa__init(pa_module*m) {
     int r;
 #endif
 
-#if defined(USE_PROTOCOL_NATIVE) || defined(USE_PROTOCOL_HTTP)
+#if (defined(USE_PROTOCOL_NATIVE) && !defined(USE_TCP_SOCKETS)) || defined(USE_PROTOCOL_HTTP)
     char t[256];
 #endif
 
@@ -364,14 +364,22 @@ int pa__init(pa_module*m) {
 
 #if defined(USE_PROTOCOL_NATIVE)
 #  if defined(USE_TCP_SOCKETS)
+/* Tizen hack: The pa_socket_server_get_address() calls are disabled for TCP,
+ * because they call pa_get_fqdn(), which in some testing environments causes
+ * 10 second delays. This hack prevents module-zeroconf-publish and from
+ * working, but who cares :) The proper fix would be to make the FQDN query
+ * asynchronous, bug tracked here:
+ * https://bugs.freedesktop.org/show_bug.cgi?id=81802 */
+#    if 0
     if (u->socket_server_ipv4)
         if (pa_socket_server_get_address(u->socket_server_ipv4, t, sizeof(t)))
             pa_native_protocol_add_server_string(u->native_protocol, t);
 
-#    ifdef HAVE_IPV6
+#      ifdef HAVE_IPV6
     if (u->socket_server_ipv6)
         if (pa_socket_server_get_address(u->socket_server_ipv6, t, sizeof(t)))
             pa_native_protocol_add_server_string(u->native_protocol, t);
+#      endif
 #    endif
 #  else
     if (pa_socket_server_get_address(u->socket_server_unix, t, sizeof(t)))
@@ -458,20 +466,23 @@ void pa__done(pa_module*m) {
     }
 #elif defined(USE_PROTOCOL_NATIVE)
     if (u->native_protocol) {
-
-        char t[256];
-
 #  if defined(USE_TCP_SOCKETS)
+/* See the previous comment about disabling pa_socket_server_get_address()
+ * (search for phrase "Tizen hack"). */
+#    if 0
         if (u->socket_server_ipv4)
             if (pa_socket_server_get_address(u->socket_server_ipv4, t, sizeof(t)))
                 pa_native_protocol_remove_server_string(u->native_protocol, t);
 
-#    ifdef HAVE_IPV6
+#      ifdef HAVE_IPV6
         if (u->socket_server_ipv6)
             if (pa_socket_server_get_address(u->socket_server_ipv6, t, sizeof(t)))
                 pa_native_protocol_remove_server_string(u->native_protocol, t);
+#      endif
 #    endif
 #  else
+        char t[256];
+
         if (u->socket_server_unix)
             if (pa_socket_server_get_address(u->socket_server_unix, t, sizeof(t)))
                 pa_native_protocol_remove_server_string(u->native_protocol, t);