}
//LCOV_EXCL_START
-static int __dnssd_ref_mdns_dbus(void)
-{
- GDBusConnection *netconfig_bus = NULL;
- GError *g_error = NULL;
-
- DNSSD_LOGD("Request to increase ref count for mdnsd");
-
-#if !GLIB_CHECK_VERSION(2, 36, 0)
- g_type_init();
-#endif
- netconfig_bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &g_error);
- if (netconfig_bus == NULL) {
- if (g_error != NULL) {
- DNSSD_LOGE("Couldn't connect to system bus "
- "error [%d: %s]", g_error->code, g_error->message);
- g_error_free(g_error);
- }
- return DNSSD_ERROR_OPERATION_FAILED;
- }
-
- g_dbus_connection_call_sync(netconfig_bus,
- NETCONFIG_SERVICE,
- NETCONFIG_NETWORK_PATH,
- NETCONFIG_NETWORK_INTERFACE,
- NETCONFIG_NETWORK_REFMDNS,
- NULL,
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- DBUS_REPLY_TIMEOUT,
- NULL,
- &g_error);
-
- if (g_error != NULL) {
- DNSSD_LOGE("g_dbus_connection_call failed. "
- "error [%d: %s]", g_error->code, g_error->message);
- g_error_free(g_error);
- return DNSSD_ERROR_OPERATION_FAILED;
- }
-
- g_object_unref(netconfig_bus);
-
- return DNSSD_ERROR_NONE;
-
-}
-//LCOV_EXCL_STOP
-
-//LCOV_EXCL_START
static int __dnssd_unref_mdns_dbus(void)
{
GDBusConnection *netconfig_bus = NULL;
//LCOV_EXCL_START
static int __dnssd_launch_mdns()
{
+ __DNSSD_LOG_FUNC_ENTER__;
int res = DNSSD_ERROR_NONE;
- int dnssd_err = 0;
- int retry_count = DNSSD_MDNSD_LAUNCH_RETRY_THRESHOLD;
- uint32_t version = 0;
- uint32_t size = sizeof(version);
-
- while (retry_count >= 0) {
- dnssd_err = DNSServiceGetProperty(kDNSServiceProperty_DaemonVersion, &version, &size);
- if (!dnssd_err) {
- DNSSD_LOGD("Daemon is running ver. %d.%d", version / 10000, version / 100 % 100);
-
- res = __dnssd_ref_mdns_dbus();
- if (res != DNSSD_ERROR_NONE)
- DNSSD_LOGE("Fail to increase ref count for mdnsd");
- else
- break;
- } else {
- DNSSD_LOGE("Daemon is not running");
- }
-
- DNSSD_LOGD("Launching mdnsresponder. retry count: %d", retry_count);
- res = __dnssd_launch_mdns_dbus();
- if (res != DNSSD_ERROR_NONE)
- DNSSD_LOGE("Fail to send dbus msg");
- retry_count--;
-
- /* wait a little before retrying the next trial */
- usleep(DNSSD_MDNSD_LAUNCH_TRIAL_INTERVAL);
- }
+ res = __dnssd_launch_mdns_dbus();
+ if (res != DNSSD_ERROR_NONE)
+ DNSSD_LOGE("Fail to send dbus msg");
+ __DNSSD_LOG_FUNC_EXIT__;
return res;
}
//LCOV_EXCL_STOP