feat(raft-drive-async): bound peer connect (O_NONBLOCK+poll), close tasks 1.3/1.4/1.5

socket_connect sets O_NONBLOCK before connect and bounds the attempt with
poll(timeout); new connect_timeout_ms param (0=DEFAULT_CONNECT_TIMEOUT_MS);
all 5 callers updated (ha.c x3, client.c, xcectx.c). Revalidation Trigger:
shared netio helper signature changed. Broad build links all components;
xcelib_test 278/0, controller_unit_test 194/0. 1.4/1.5 unit tests satisfied
by the TDD output of 1.2/1.3 (test_slowlane.c, test_netio_bounded_connect.c).
This commit is contained in:
Rongsong Shen 2026-06-26 07:10:53 +00:00
parent 5650acd375
commit 0781c6c027
9 changed files with 289 additions and 18 deletions

View file

@ -115,7 +115,13 @@ extern void free_packet(io_packet_t*);
extern endpoint_t* endpoint_get(void);
extern int endpoint_init(endpoint_t*, int, int, int, int);
extern int endpoint_connect(endpoint_t*, char*, int);
extern int endpoint_connect(endpoint_t*, char*, int, int);
/* socket_connect: bounded, non-blocking TCP connect on an existing fd.
* connect_timeout_ms == 0 uses DEFAULT_CONNECT_TIMEOUT_MS (config.h).
* Returns 0 on success (fd left non-blocking), -ETIMEDOUT on bound expiry,
* or -<errno> on error. raft-drive-async R2.3. */
extern int socket_connect(int sock, char* host, int port,
int connect_timeout_ms);
extern int endpoint_accept(endpoint_t*, endpoint_t*);
extern int endpoint_set_conn_handler(endpoint_t*, conn_handler_t);
extern int endpoint_enq(endpoint_t*, data_item_t*);