diff options
| author | Alexandra Ellwood <lxs@mit.edu> | 2007-07-25 19:29:39 +0000 |
|---|---|---|
| committer | Alexandra Ellwood <lxs@mit.edu> | 2007-07-25 19:29:39 +0000 |
| commit | e623c00ce9df3580e6eb1b0337fe1d9727fb61e6 (patch) | |
| tree | d1a3fdad976a0e3084833eedd6fd164b20adf419 /src/ccapi/lib | |
| parent | ffb9fc8c748b864a3404500f5298041be4bb01c1 (diff) | |
| download | krb5-e623c00ce9df3580e6eb1b0337fe1d9727fb61e6.tar.gz krb5-e623c00ce9df3580e6eb1b0337fe1d9727fb61e6.tar.xz krb5-e623c00ce9df3580e6eb1b0337fe1d9727fb61e6.zip | |
Added callback support for wait_for_change functions
ticket: 4644
status: open
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19731 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/ccapi/lib')
| -rw-r--r-- | src/ccapi/lib/ccapi_ccache.c | 22 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_context.c | 28 |
2 files changed, 45 insertions, 5 deletions
diff --git a/src/ccapi/lib/ccapi_ccache.c b/src/ccapi/lib/ccapi_ccache.c index 5a975810c..485e6ceea 100644 --- a/src/ccapi/lib/ccapi_ccache.c +++ b/src/ccapi/lib/ccapi_ccache.c @@ -44,6 +44,7 @@ typedef struct cci_ccache_d { cc_ccache_f *vector_functions; #endif cci_identifier_t identifier; + cc_time_t last_wait_for_change_time; } *cci_ccache_t; /* ------------------------------------------------------------------------ */ @@ -52,6 +53,7 @@ struct cci_ccache_d cci_ccache_initializer = { NULL VECTOR_FUNCTIONS_INITIALIZER, NULL, + 0 }; cc_ccache_f cci_ccache_f_initializer = { @@ -594,15 +596,33 @@ cc_int32 ccapi_ccache_wait_for_change (cc_ccache_t in_ccache) { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; + cci_stream_t request = NULL; + cci_stream_t reply = NULL; if (!in_ccache) { err = cci_check_error (ccErrBadParam); } if (!err) { + err = cci_stream_new (&request); + } + + if (!err) { + err = cci_stream_write_time (request, ccache->last_wait_for_change_time); + } + + if (!err) { err = cci_ipc_send (cci_ccache_wait_for_change_msg_id, ccache->identifier, - NULL, NULL); + request, + &reply); } + + if (!err) { + err = cci_stream_read_time (reply, &ccache->last_wait_for_change_time); + } + cci_stream_release (request); + cci_stream_release (reply); + return cci_check_error (err); } diff --git a/src/ccapi/lib/ccapi_context.c b/src/ccapi/lib/ccapi_context.c index 7a24f2248..feccc85a4 100644 --- a/src/ccapi/lib/ccapi_context.c +++ b/src/ccapi/lib/ccapi_context.c @@ -43,6 +43,7 @@ typedef struct cci_context_d { #endif cci_identifier_t identifier; cc_uint32 synchronized; + cc_time_t last_wait_for_change_time; } *cci_context_t; /* ------------------------------------------------------------------------ */ @@ -51,6 +52,7 @@ struct cci_context_d cci_context_initializer = { NULL VECTOR_FUNCTIONS_INITIALIZER, NULL, + 0, 0 }; @@ -249,19 +251,37 @@ cc_int32 ccapi_context_wait_for_change (cc_context_t in_context) { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; + cci_stream_t request = NULL; + cci_stream_t reply = NULL; if (!in_context) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_context_sync (context, 0); + err = cci_stream_new (&request); } if (!err) { - err = cci_ipc_send_no_launch (cci_context_wait_for_change_msg_id, - context->identifier, - NULL, NULL); + err = cci_stream_write_time (request, context->last_wait_for_change_time); + } + + if (!err) { + err = cci_context_sync (context, 1); } + if (!err) { + err = cci_ipc_send (cci_context_wait_for_change_msg_id, + context->identifier, + request, + &reply); + } + + if (!err) { + err = cci_stream_read_time (reply, &context->last_wait_for_change_time); + } + + cci_stream_release (request); + cci_stream_release (reply); + return cci_check_error (err); } |
