#include "cal_client_db_helper.h"
#define CAL_DBUS_RETRY_MAX 1
-#define CAL_DBUS_RETRY_CALL(func) \
- int _d_ret = -1; \
- int _d_count = 0; \
- while (CALENDAR_ERROR_NONE != _d_ret) { \
- _d_ret = func; \
- if (CALENDAR_ERROR_NONE == _d_ret) \
+#define CAL_DBUS_RETRY_CALL(ret, func) \
+ int retry_count = 0; \
+ while (retry_count <= CAL_DBUS_RETRY_MAX) { \
+ ret = func; \
+ if (CALENDAR_ERROR_IPC != ret) \
break; \
- _d_count++; \
- if (CAL_DBUS_RETRY_MAX < _d_count) { \
- ERR("retry call: reach max(%d)", _d_count); \
- break; \
- } \
- ERR("retry call:count(%d)", _d_count); \
+ ERR("retry call"); \
cal_dbus_recovery(); \
- } \
- ret = _d_ret;
+ retry_count++; \
+ }
EXPORT_API int calendar_db_insert_record(calendar_record_h record, int* id)
{
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_insert_record(handle, record, id));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_insert_record(handle, record, id));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_update_record(handle, record));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_update_record(handle, record));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_delete_record(handle, view_uri, id));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_delete_record(handle, view_uri, id));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_replace_record(handle, record, record_id));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_replace_record(handle, record, record_id));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_get_record(handle, view_uri, id, out_record));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_get_record(handle, view_uri, id, out_record));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_get_all_records(handle, view_uri, offset, limit, out_list));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_get_all_records(handle, view_uri, offset, limit, out_list));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_get_records_with_query(handle, query, offset, limit, out_list));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_get_records_with_query(handle, query, offset, limit, out_list));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_clean_after_sync(handle, book_id, calendar_db_version));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_clean_after_sync(handle, book_id, calendar_db_version));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_get_count(handle, view_uri, out_count));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_get_count(handle, view_uri, out_count));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_get_count_with_query(handle, query, out_count));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_get_count_with_query(handle, query, out_count));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_insert_records(handle, record_list, record_id_array, count));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_insert_records(handle, record_list, record_id_array, count));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_update_records(handle, record_list));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_update_records(handle, record_list));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_delete_records(handle, view_uri, record_id_array, count));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_delete_records(handle, view_uri, record_id_array, count));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_replace_records(handle, record_list, record_id_array, count));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_replace_records(handle, record_list, record_id_array, count));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_get_changes_by_version(handle, view_uri, book_id,
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_get_changes_by_version(handle, view_uri, book_id,
calendar_db_version, record_list, current_version));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_get_current_version(handle, current_version));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_get_current_version(handle, current_version));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_add_changed_cb(handle, view_uri, callback, user_data));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_add_changed_cb(handle, view_uri, callback, user_data));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_remove_changed_cb(handle, view_uri, callback, user_data));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_remove_changed_cb(handle, view_uri, callback, user_data));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_insert_vcalendars(handle, vcalendar_stream, record_id_array, count));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_insert_vcalendars(handle, vcalendar_stream, record_id_array, count));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_replace_vcalendars(handle, vcalendar_stream, record_id_array, count));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_replace_vcalendars(handle, vcalendar_stream, record_id_array, count));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_get_last_change_version(handle, last_version));
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_get_last_change_version(handle, last_version));
return ret;
}
ret = cal_client_handle_get_p(&handle);
RETVM_IF(CALENDAR_ERROR_NONE != ret, ret, "cal_client_handle_get_p() Fail(%d)", ret);
- CAL_DBUS_RETRY_CALL(cal_dbus_get_changes_exception_by_version(handle, view_uri,
+ CAL_DBUS_RETRY_CALL(ret, cal_dbus_get_changes_exception_by_version(handle, view_uri,
original_event_id, calendar_db_version, record_list));
return ret;
}