diff options
Diffstat (limited to 'src/ccapi/server/ccs_cache_collection.c')
| -rw-r--r-- | src/ccapi/server/ccs_cache_collection.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/src/ccapi/server/ccs_cache_collection.c b/src/ccapi/server/ccs_cache_collection.c index 543f99c207..f838c9ade6 100644 --- a/src/ccapi/server/ccs_cache_collection.c +++ b/src/ccapi/server/ccs_cache_collection.c @@ -484,6 +484,7 @@ cc_int32 ccs_cache_collection_set_default_ccache (ccs_cache_collection_t io_cac cc_int32 err = ccNoError; ccs_ccache_t old_default = NULL; ccs_ccache_t new_default = NULL; + cc_uint32 equal = 0; if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); } if (!in_identifier ) { err = cci_check_error (ccErrBadParam); } @@ -494,29 +495,34 @@ cc_int32 ccs_cache_collection_set_default_ccache (ccs_cache_collection_t io_cac } if (!err) { - err = ccs_ccache_list_push_front (io_cache_collection->ccaches, - in_identifier); - } - - if (!err) { - err = ccs_ccache_notify_default_state_changed (old_default, - io_cache_collection, - FALSE /* no longer default */); - } - - if (!err) { - err = ccs_cache_collection_get_default_ccache (io_cache_collection, - &new_default); + err = ccs_ccache_compare_identifier (old_default, in_identifier, &equal); } - if (!err) { - err = ccs_ccache_notify_default_state_changed (new_default, - io_cache_collection, - TRUE /* now default */); - } - if (!err) { - err = ccs_cache_collection_changed (io_cache_collection); + if (!err && !equal) { + err = ccs_ccache_list_push_front (io_cache_collection->ccaches, + in_identifier); + + if (!err) { + err = ccs_ccache_notify_default_state_changed (old_default, + io_cache_collection, + FALSE /* no longer default */); + } + + if (!err) { + err = ccs_cache_collection_get_default_ccache (io_cache_collection, + &new_default); + } + + if (!err) { + err = ccs_ccache_notify_default_state_changed (new_default, + io_cache_collection, + TRUE /* now default */); + } + + if (!err) { + err = ccs_cache_collection_changed (io_cache_collection); + } } return cci_check_error (err); |
