feat(libxce-failover): reconnect/rejoin hook — public setter + post-reconnect invocation before resume (task 4.1)
This commit is contained in:
parent
12284bc3f5
commit
8783ce5a9d
6 changed files with 264 additions and 26 deletions
|
|
@ -76,6 +76,27 @@ int xcecli_set_handler(xcecli_ctx_t c, xce_request_handler_t handler,
|
|||
return xce_ctx_set_handler(&(ctx->ctx), handler, args);
|
||||
}
|
||||
|
||||
/*
|
||||
* xcecli_set_reconnect_handler (task 4.1) — register the consumer rejoin hook
|
||||
* the failover loop invokes after a transparent reconnect, before resuming the
|
||||
* interrupted op. A NULL cb clears any previously registered hook (back to the
|
||||
* pure-client no-op path). Stores cb+arg on the per-ctx failover state.
|
||||
*/
|
||||
int xcecli_set_reconnect_handler(xcecli_ctx_t c, xcecli_reconnect_cb cb,
|
||||
void* arg)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
||||
if (c == NULL) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ctx->failover.rejoin_cb = cb;
|
||||
ctx->failover.rejoin_arg = arg;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int xcecli_wakeup(xcecli_ctx_t c, int status)
|
||||
{
|
||||
api_ctx_t* ctx = (api_ctx_t*)c;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue