feat(libxce-failover): best-effort single-shot reconnect for fire-and-forget ops (notify/heartbeat/nop) (task 5.2)

This commit is contained in:
Rongsong Shen 2026-06-17 04:08:58 +00:00
parent 4345974b54
commit fdb8938059
5 changed files with 210 additions and 4 deletions

View file

@ -189,6 +189,22 @@ int xcecli_ctx_recover(api_ctx_t* ac)
return 0;
}
/* ════════════════════════════════════════════════════════════════════════
* Fire-and-forget best-effort reconnect predicate (task 5.2)
* ════════════════════════════════════════════════════════════════════════ */
bool xcecli_ff_needs_reconnect(const api_ctx_t* ac)
{
if (ac == NULL)
return false;
/* Only a transport-ERR connection (set by the disconnect path) is treated
* as known-dead and reconnected best-effort. A live RUN ctx sends directly;
* a deliberately-stopped DOWN or not-yet-started INIT ctx is never
* resurrected by a fire-and-forget op. */
return ac->ctx.state == XCE_CTX_ERR;
}
/* ════════════════════════════════════════════════════════════════════════
* ReconnectRejoinHook — invoke the consumer rejoin callback (1.2)
* ════════════════════════════════════════════════════════════════════════ */