Fix bug
[platform/core/connectivity/asp-manager.git] / src / tech / asp-tech-infra.c
index 0411b72..67c3e90 100644 (file)
@@ -232,8 +232,8 @@ static gint32 __asp_service_infra_convert_error_type(gint32 dnssd_error)
 
 static void __init_hash_tables()
 {
-       g_local_service_hash = g_hash_table_new(g_int_hash, g_int_equal);
-       g_browser_hash = g_hash_table_new(g_int_hash, g_int_equal);
+       g_local_service_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
+       g_browser_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
 }
 
 static void __g_hash_free_handle(gpointer key, gpointer value, gpointer user_data)
@@ -393,7 +393,7 @@ gint32 asp_tech_infra_advertise(asp_service_advertise_s *service, gint32 replace
        ASP_LOGD("Success to register local service %u", service_handle);
 
        g_hash_table_insert(g_local_service_hash,
-                       &service->adv_id, &service_handle);
+                       GUINT_TO_POINTER(service->adv_id), GUINT_TO_POINTER(service_handle));
 
        ASP_LOGD("Insert (%u, %u) to g_local_service_hash (size: %d)",
                        service->adv_id, service_handle,
@@ -448,8 +448,8 @@ gint32 asp_tech_infra_cancel_advertise(asp_service_advertise_s *service)
        gint32 result = 0;
        dnssd_service_h service_handle;
 
-       service_handle = *(dnssd_service_h*)g_hash_table_lookup(g_local_service_hash,
-                                                                                                               &service->adv_id);
+       service_handle = (dnssd_service_h)GPOINTER_TO_UINT(g_hash_table_lookup(g_local_service_hash,
+                                                                                                               GUINT_TO_POINTER(service->adv_id)));
 
        if (!service_handle) {
                /* TODO */
@@ -460,6 +460,7 @@ gint32 asp_tech_infra_cancel_advertise(asp_service_advertise_s *service)
        result = dnssd_deregister_local_service(service_handle);
        if (result != DNSSD_ERROR_NONE) {
                result = __asp_service_infra_convert_error_type(result);
+               ASP_LOGE("Failed to deregister local service %u", service_handle);
                return result;
        }
        ASP_LOGD("Success to deregister local service: %u", service_handle);
@@ -479,7 +480,7 @@ gint32 asp_tech_infra_seek(asp_service_seek_s *service)
 {
        __ASP_LOG_FUNC_ENTER__;
        gint32 result = 0;
-       dnssd_service_h browser_handle;
+       dnssd_browser_h browser_handle;
        gchar *if_name;
        wifi_manager_h wifi_handle = NULL;
 
@@ -515,7 +516,7 @@ gint32 asp_tech_infra_seek(asp_service_seek_s *service)
                        service->service_type, browser_handle);
 
        g_hash_table_insert(g_browser_hash,
-                       &service->search_id, &browser_handle);
+                       GUINT_TO_POINTER(service->search_id), GUINT_TO_POINTER(browser_handle));
 
        ASP_LOGD("Insert (%u, %u) to g_browser_hash (size: %d)",
                        service->search_id, browser_handle,
@@ -530,10 +531,10 @@ gint32 asp_tech_infra_cancel_seek(asp_service_seek_s *service)
 {
        __ASP_LOG_FUNC_ENTER__;
        gint32 result = 0;
-       dnssd_service_h browser_handle;
+       dnssd_browser_h browser_handle;
 
-       browser_handle = *(dnssd_service_h*)g_hash_table_lookup(g_browser_hash,
-                                                                                                               &service->search_id);
+       browser_handle = (dnssd_browser_h)GPOINTER_TO_UINT(g_hash_table_lookup(g_browser_hash,
+                                                                                                               GUINT_TO_POINTER(service->search_id)));
 
        if (!browser_handle) {
                /* TODO */