feat(election-iomgr-refactor): add vote_ep_ctx_t and on_vote_connected

- vote_ep_ctx_t: per-peer context (ha, c, ctx, peer_idx, term/tag/lsn/name)
- election_timeout_ctx_t: cancelled flag + context for delay watchdog
- on_vote_connected(): iomgr callback fires after SSL handshake; builds
  xce_request_t{opcode=OPCode_requestVote}, calls xce_request, sets msg_handler
- vote_reply_msg_handler stub (returns 0; implemented in task 2.3)
- Test seam: xce_vote_request_hook for unit testing without live SSL
- 4 new unit tests: opcode, field encoding, msg_handler set, cancelled flag

Context note: vctx->c is NULL in test helper — task 2.3 must use real cluster_t*
This commit is contained in:
Rongsong Shen 2026-05-30 08:09:33 +00:00
parent 0d7757fdd5
commit 18c280429e
4 changed files with 500 additions and 0 deletions

View file

@ -111,6 +111,7 @@ controller_unit_test_src = [
'testsuite/test_ha_connect.c',
'testsuite/test_ha_ctrlhello.c',
'testsuite/test_ha_failover.c',
'testsuite/test_ha_vote_send.c',
'startup_validation.c',
'worker.c',
'persist.c',