feat(libxce-failover): capture redirect hint in handle_reply (before free, before status return); verify endpoint-error wake (task 2.3)

This commit is contained in:
Rongsong Shen 2026-06-17 03:11:18 +00:00
parent c7e11a4e9e
commit cec2e647dc
4 changed files with 192 additions and 1 deletions

View file

@ -59,4 +59,19 @@ extern int xce_ctx_set_endpoint(xce_ctx_t*, endpoint_t*);
extern void xce_block_tasks(xce_ctx_t*);
extern void xce_unblock_tasks(xce_ctx_t*);
/*
* xce_ctx_capture_redirect_hint: copy a redirect address carried on a reply
* into the ctx's redirect_hint_host/port fields as a best-effort failover hint
* (Req 2.2, 8.3). Called by handle_reply() BEFORE the capnp-owned reply (and
* its redirect_host string) is freed.
*
* When `host` is NULL/empty or `port` is 0 there is no usable address: the hint
* is left untouched (it stays empty). Otherwise the host is bounded-copied into
* the fixed-size field (truncated + NUL-terminated, never overflowing) and the
* port is stored. A NULL ctx is a safe no-op. Advisory only — correctness never
* depends on the hint.
*/
extern void xce_ctx_capture_redirect_hint(xce_ctx_t*, const char* host,
uint16_t port);
#endif