int ctsvc_client_db_add_status_changed_cb(contacts_h contact,
contacts_db_status_changed_cb cb, void* user_data)
{
+ int ret;
status_callback_info_s *cb_info = NULL;
RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
RETVM_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER,
"Invalid parameter : callback is null");
+ ret = ctsvc_ipc_create_for_change_subscription();
+ if (CONTACTS_ERROR_NONE != ret) {
+ CTS_ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
+ return ret;
+ }
+
ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
if (pims_ipc_subscribe(ctsvc_ipc_get_handle_for_change_subsciption(),
int ctsvc_client_db_remove_status_changed_cb(contacts_h contact,
contacts_db_status_changed_cb cb, void* user_data)
{
+ int ret;
GSList *l;
RETVM_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER, "contact is NULL");
RETVM_IF(NULL == cb, CONTACTS_ERROR_INVALID_PARAMETER,
"Invalid parameter : callback is null");
+ ret = ctsvc_ipc_destroy_for_change_subscription(false);
+ if (CONTACTS_ERROR_NONE != ret) {
+ CTS_ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
+ return ret;
+ }
+
ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
for (l = __status_change_subscribe_list;l;l=l->next) {
status_callback_info_s *cb_info = l->data;
pims_ipc_h ctsvc_ipc_get_handle_for_change_subsciption();
int ctsvc_ipc_create_for_change_subscription();
-int ctsvc_ipc_destroy_for_change_subscription();
+int ctsvc_ipc_destroy_for_change_subscription(bool is_disconnect);
int ctsvc_ipc_recover_for_change_subscription();
int ctsvc_ipc_call(char *module, char *function, pims_ipc_h data_in, pims_ipc_data_h *data_out);
return CONTACTS_ERROR_NONE;
}
-int ctsvc_ipc_destroy_for_change_subscription()
+int ctsvc_ipc_destroy_for_change_subscription(bool is_disconnect)
{
ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
+ if (is_disconnect) {
+ if (0 < __ipc_pubsub_ref) {
+ pims_ipc_destroy_for_subscribe(__ipc);
+ __ipc = NULL;
+ __ipc_pubsub_ref = 0;
+ }
+ ctsvc_mutex_unlock(CTS_MUTEX_PIMS_IPC_PUBSUB);
+ return CONTACTS_ERROR_NONE;
+ }
if (1 == __ipc_pubsub_ref) {
pims_ipc_destroy_for_subscribe(__ipc);
return CONTACTS_ERROR_INVALID_PARAMETER;
}
+ ret = ctsvc_ipc_create_for_change_subscription();
+ if (CONTACTS_ERROR_NONE != ret) {
+ CTS_ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
+ return ret;
+ }
+
ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
for (it=__db_change_subscribe_list;it;it=it->next) {
API int contacts_db_remove_changed_cb_with_info(const char* view_uri,
contacts_db_change_cb_with_info cb, void* user_data)
{
+ int ret;
GSList *it = NULL;
subscribe_info_s *info = NULL;
return CONTACTS_ERROR_INVALID_PARAMETER;
}
+ ret = ctsvc_ipc_destroy_for_change_subscription(false);
+ if (CONTACTS_ERROR_NONE != ret) {
+ CTS_ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
+ return ret;
+ }
+
ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
for (it=__db_change_subscribe_list;it;it=it->next) {
return ret;
}
ctsvc_view_uri_init();
- ctsvc_ipc_create_for_change_subscription();
}
else
CTS_DBG("System : Contacts service has been already connected(%d)", _ctsvc_connection + 1);
base->connection_count--;
if (1 == _ctsvc_connection) {
- ctsvc_ipc_destroy_for_change_subscription();
+ ctsvc_ipc_destroy_for_change_subscription(true);
ctsvc_view_uri_deinit();
ctsvc_inotify_close();
ctsvc_socket_final();
return ret;
}
ctsvc_view_uri_init();
- ctsvc_ipc_create_for_change_subscription();
}
else if (0 < _ctsvc_connection_on_thread)
CTS_DBG("System : Contacts service has been already connected");
base->connection_count--;
if (1 == _ctsvc_connection_on_thread) {
- ctsvc_ipc_destroy_for_change_subscription();
+ if (0 == _ctsvc_connection)
+ ctsvc_ipc_destroy_for_change_subscription(true);
ctsvc_view_uri_deinit();
ctsvc_inotify_close();
ctsvc_socket_final();
RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED, "Permission denied (contact read)");
+ ret = ctsvc_ipc_create_for_change_subscription();
+ if (CONTACTS_ERROR_NONE != ret) {
+ CTS_ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
+ return ret;
+ }
+
ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
if (NULL == __setting_name_display_order_subscribe_list) {
API int contacts_setting_remove_name_display_order_changed_cb(
contacts_setting_name_display_order_changed_cb cb, void* user_data)
{
+ int ret;
RETVM_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : callback is NULL");
+ ret = ctsvc_ipc_destroy_for_change_subscription(false);
+ if (CONTACTS_ERROR_NONE != ret) {
+ CTS_ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
+ return ret;
+ }
+
ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
if (__setting_name_display_order_subscribe_list) {
RETVM_IF(CONTACTS_ERROR_NONE != ret, ret, "ctsvc_ipc_client_check_permission fail (%d)", ret);
RETVM_IF(result == false, CONTACTS_ERROR_PERMISSION_DENIED, "Permission denied (contact read)");
+ ret = ctsvc_ipc_create_for_change_subscription();
+ if (CONTACTS_ERROR_NONE != ret) {
+ CTS_ERR("ctsvc_ipc_create_for_change_subscription() Fail(%d)", ret);
+ return ret;
+ }
+
ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
if (NULL == __setting_name_sorting_order_subscribe_list) {
API int contacts_setting_remove_name_sorting_order_changed_cb(
contacts_setting_name_sorting_order_changed_cb cb, void* user_data)
{
+ int ret;
RETVM_IF(cb == NULL, CONTACTS_ERROR_INVALID_PARAMETER, "Invalid parameter : callback is NULL");
+ ret = ctsvc_ipc_destroy_for_change_subscription(false);
+ if (CONTACTS_ERROR_NONE != ret) {
+ CTS_ERR("ctsvc_ipc_destroy_for_change_subscription() Fail(%d)", ret);
+ return ret;
+ }
+
ctsvc_mutex_lock(CTS_MUTEX_PIMS_IPC_PUBSUB);
if (__setting_name_sorting_order_subscribe_list) {