From: Seungha Son Date: Thu, 18 Jan 2018 08:08:06 +0000 (+0900) Subject: Change ipc init timing X-Git-Tag: accepted/tizen/unified/20180119.133825~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97d658d20c6b22b0682841ebb0c90d6d1f24e380;p=platform%2Fcore%2Fapi%2Fnotification.git Change ipc init timing Signed-off-by: Seungha Son Change-Id: Iadf84e14e6cbede472b31df9dbbfa8749e955af8 --- diff --git a/src/notification_internal.c b/src/notification_internal.c index 45d655b..c09f872 100755 --- a/src/notification_internal.c +++ b/src/notification_internal.c @@ -220,9 +220,6 @@ EXPORT_API int notification_resister_changed_cb_for_uid( if (changed_cb == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - if (notification_ipc_monitor_init(uid) != NOTIFICATION_ERROR_NONE) - return NOTIFICATION_ERROR_IO_ERROR; - if (_noti_cb_hash == NULL) _noti_cb_hash = g_hash_table_new(g_direct_hash, g_direct_equal); @@ -248,6 +245,11 @@ EXPORT_API int notification_resister_changed_cb_for_uid( noti_cb_list = g_list_append(noti_cb_list, noti_cb_info_new); } + if (notification_ipc_monitor_init(uid) != NOTIFICATION_ERROR_NONE) { + notification_unresister_changed_cb_for_uid(changed_cb, uid); + return NOTIFICATION_ERROR_IO_ERROR; + } + return NOTIFICATION_ERROR_NONE; } @@ -1184,9 +1186,6 @@ EXPORT_API int notification_register_detailed_changed_cb_for_uid( if (detailed_changed_cb == NULL) return NOTIFICATION_ERROR_INVALID_PARAMETER; - if (notification_ipc_monitor_init(uid) != NOTIFICATION_ERROR_NONE) - return NOTIFICATION_ERROR_IO_ERROR; - if (_noti_cb_hash == NULL) _noti_cb_hash = g_hash_table_new(g_direct_hash, g_direct_equal); @@ -1212,6 +1211,11 @@ EXPORT_API int notification_register_detailed_changed_cb_for_uid( noti_cb_list = g_list_append(noti_cb_list, noti_cb_info_new); } + if (notification_ipc_monitor_init(uid) != NOTIFICATION_ERROR_NONE) { + notification_unregister_detailed_changed_cb_for_uid(detailed_changed_cb, user_data, uid); + return NOTIFICATION_ERROR_IO_ERROR; + } + return NOTIFICATION_ERROR_NONE; } diff --git a/src/notification_ipc.c b/src/notification_ipc.c index 4ac8d97..9abf88e 100755 --- a/src/notification_ipc.c +++ b/src/notification_ipc.c @@ -2503,6 +2503,8 @@ static int _send_service_register(uid_t uid) return result; } + is_master_started = 1; + noti_op = _ipc_create_op(NOTIFICATION_OP_SERVICE_READY, 1, NULL, 1, NULL); if (noti_op != NULL) { notification_call_changed_cb_for_uid(noti_op, 1, uid); @@ -2529,8 +2531,9 @@ static void _on_name_appeared(GDBusConnection *connection, int uid = GPOINTER_TO_INT(user_data); DBG("uid[%d] name[%s]", uid, name); - is_master_started = 1; - _ipc_monitor_register(uid); + + if (is_master_started == 0) + _ipc_monitor_register(uid); /* TODO: dbus activation isn't enough ? */ _do_deffered_task(); @@ -2578,7 +2581,6 @@ int notification_ipc_monitor_init(uid_t uid) } if (provider_monitor_id == 0) { - provider_monitor_id = g_bus_watch_name_on_connection( _gdbus_conn, PROVIDER_BUS_NAME,