feat: support name=host:port format in controller --peers

- xce_candidate_t gains name[] field for logical peer identity
- parse_peers stores name prefix before '=' (empty when omitted)
- cluster_init matches own identity by name first, hostname as fallback
  enabling multiple controllers on the same dev host via
  --peers ctrl-1=10.0.1.1:7000,ctrl-2=10.0.1.2:7001
This commit is contained in:
Rongsong Shen 2026-05-08 06:51:54 +00:00
parent 59597e105e
commit a05c9bd344
3 changed files with 23 additions and 8 deletions

View file

@ -10,9 +10,13 @@
#include "config.h" /* MAX_HA_CANDIDATES, XCE_MAXHOSTNAME_LEN */
/**
* A single controller candidate (host + port).
* A single controller candidate.
* name: logical name from "name=host:port" syntax (empty if omitted).
* Matching against myconf->name allows multiple controllers on the same
* dev host to distinguish themselves by name rather than IP address.
*/
typedef struct {
char name[XCE_MAXNAME_LEN];
char hostname[XCE_MAXHOSTNAME_LEN];
int port;
} xce_candidate_t;