+ pa_assert(m);
+
+ if (!(u = m->userdata))
+ return;
+
+#if defined(USE_PROTOCOL_SIMPLE)
+ if (u->simple_protocol) {
+ pa_simple_protocol_disconnect(u->simple_protocol, u->module);
+ pa_simple_protocol_unref(u->simple_protocol);
+ }
+ if (u->simple_options)
+ pa_simple_options_unref(u->simple_options);
+#elif defined(USE_PROTOCOL_CLI)
+ if (u->cli_protocol) {
+ pa_cli_protocol_disconnect(u->cli_protocol, u->module);
+ pa_cli_protocol_unref(u->cli_protocol);
+ }
+#elif defined(USE_PROTOCOL_HTTP)
+ if (u->http_protocol) {
+ char t[256];
+
+#if defined(USE_TCP_SOCKETS)
+ if (u->socket_server_ipv4)
+ if (pa_socket_server_get_address(u->socket_server_ipv4, t, sizeof(t)))
+ pa_http_protocol_remove_server_string(u->http_protocol, t);
+
+#ifdef HAVE_IPV6
+ if (u->socket_server_ipv6)
+ if (pa_socket_server_get_address(u->socket_server_ipv6, t, sizeof(t)))
+ pa_http_protocol_remove_server_string(u->http_protocol, t);
+#endif /* HAVE_IPV6 */
+#else /* USE_TCP_SOCKETS */
+ if (u->socket_server_unix)
+ if (pa_socket_server_get_address(u->socket_server_unix, t, sizeof(t)))
+ pa_http_protocol_remove_server_string(u->http_protocol, t);
+#endif /* USE_PROTOCOL_HTTP */
+
+ pa_http_protocol_disconnect(u->http_protocol, u->module);
+ pa_http_protocol_unref(u->http_protocol);
+ }
+#elif defined(USE_PROTOCOL_NATIVE)
+ if (u->native_protocol) {
+
+ char t[256];
+
+# if defined(USE_TCP_SOCKETS)
+ 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
+ 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
+# else
+ 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);
+# endif
+
+ pa_native_protocol_disconnect(u->native_protocol, u->module);
+ pa_native_protocol_unref(u->native_protocol);
+ }
+ if (u->native_options)
+ pa_native_options_unref(u->native_options);
+#else
+ if (u->esound_protocol) {
+ pa_esound_protocol_disconnect(u->esound_protocol, u->module);
+ pa_esound_protocol_unref(u->esound_protocol);
+ }
+ if (u->esound_options)
+ pa_esound_options_unref(u->esound_options);
+#endif