Notify clients on ccache deletion
authorAlexandra Ellwood <lxs@mit.edu>
Wed, 20 Aug 2008 18:46:46 +0000 (18:46 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Wed, 20 Aug 2008 18:46:46 +0000 (18:46 +0000)
Clients watching a ccache or the cache collection
should get a notification when the ccache is destroyed.

ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20678 dc483132-0cff-0310-8789-dd5450dbe970

src/ccapi/server/ccs_cache_collection.c
src/ccapi/server/ccs_ccache.c
src/ccapi/server/ccs_ccache.h

index 02d4d8f7daa3ae078d2bd0c0e89b7c816fd07b1f..a1531bdb3a5eb28df083c5291cb407a3718b5fb9 100644 (file)
@@ -320,15 +320,28 @@ cc_int32 ccs_cache_collection_destroy_ccache (ccs_cache_collection_t  io_cache_c
                                               cci_identifier_t        in_identifier)
 {
     cc_int32 err = ccNoError;
+    ccs_ccache_t ccache = NULL;
     
     if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); }
     if (!in_identifier      ) { err = cci_check_error (ccErrBadParam); }
     
+    if (!err) {
+        err = ccs_cache_collection_find_ccache (io_cache_collection,
+                                                in_identifier, 
+                                                &ccache);
+    }
+    
+    if (!err) {
+        /* Notify before deletion because after deletion the ccache
+         * will no longer exist (and won't know about its clients) */
+        err = ccs_ccache_changed (ccache, io_cache_collection);
+    }
+
     if (!err) {
         err = ccs_ccache_list_remove (io_cache_collection->ccaches,
                                       in_identifier);
     }
-    
+
     return cci_check_error (err);
 }
 
index c2e36bf0beb878ffeb2b4ba04adfda4f5b262791..4ebf2a006d3b32cbb4edefb0f895e87eb02e38f1 100644 (file)
@@ -45,9 +45,6 @@ struct ccs_ccache_d {
 
 struct ccs_ccache_d ccs_ccache_initializer = { NULL, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL };
 
-static cc_int32 ccs_ccache_changed (ccs_ccache_t           io_ccache,
-                                    ccs_cache_collection_t io_cache_collection);
-
 /* ------------------------------------------------------------------------ */
 
 cc_int32 ccs_ccache_new (ccs_ccache_t      *out_ccache,
@@ -313,8 +310,8 @@ cc_int32 ccs_ccache_compare_name (ccs_ccache_t  in_ccache,
 
 /* ------------------------------------------------------------------------ */
 
-static cc_int32 ccs_ccache_changed (ccs_ccache_t           io_ccache,
-                                    ccs_cache_collection_t io_cache_collection)
+cc_int32 ccs_ccache_changed (ccs_ccache_t           io_ccache,
+                             ccs_cache_collection_t io_cache_collection)
 {
     cc_int32 err = ccNoError;
     cci_stream_t reply_data = NULL;
@@ -361,7 +358,7 @@ static cc_int32 ccs_ccache_changed (ccs_ccache_t           io_ccache,
            }
         }
     }
-
+    
     cci_stream_release (reply_data);
     
     return cci_check_error (err);
index ba32752ab549134280c40317c51d40734b71aa13..3e9f6ae855167dbc0c70b6c5ce0224775236e42a 100644 (file)
@@ -46,6 +46,9 @@ cc_int32 ccs_ccache_swap_contents (ccs_ccache_t           io_source_ccache,
 
 cc_int32 ccs_ccache_release (ccs_ccache_t io_ccache);
 
+cc_int32 ccs_ccache_changed (ccs_ccache_t           io_ccache,
+                             ccs_cache_collection_t io_cache_collection);
+
 cc_int32 ccs_ccache_compare_identifier (ccs_ccache_t      in_ccache,
                                         cci_identifier_t  in_identifier,
                                         cc_uint32        *out_equal);