diff options
| author | Alexandra Ellwood <lxs@mit.edu> | 2007-07-31 20:23:02 +0000 |
|---|---|---|
| committer | Alexandra Ellwood <lxs@mit.edu> | 2007-07-31 20:23:02 +0000 |
| commit | 56154de391f4a33501fcfdc6ab916e14abe52204 (patch) | |
| tree | 96f9abcfb97490c5b1b8d190cecf278da36abce5 /src/ccapi/server/ccs_cache_collection.c | |
| parent | 304539fc1dd57d93d68b98dc436fd8f84f5bdb75 (diff) | |
| download | krb5-56154de391f4a33501fcfdc6ab916e14abe52204.tar.gz krb5-56154de391f4a33501fcfdc6ab916e14abe52204.tar.xz krb5-56154de391f4a33501fcfdc6ab916e14abe52204.zip | |
Implemented and tested cc_ccache_wait_for_change()
ticket: 4644
status: open
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19740 dc483132-0cff-0310-8789-dd5450dbe970
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); |
