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:
parent
5650acd375
commit
0781c6c027
9 changed files with 289 additions and 18 deletions
|
|
@ -199,7 +199,8 @@ static int raft_cb_send_vote_request(void *ctx, int peer_idx, uint64_t term)
|
|||
endpoint_set_on_connected(ep, on_vote_connected);
|
||||
endpoint_set_err_handler(ep, vote_ep_err_handler);
|
||||
|
||||
int rc = endpoint_connect(ep, peer->hostname, peer->port);
|
||||
int rc = endpoint_connect(ep, peer->hostname, peer->port,
|
||||
DEFAULT_CONNECT_TIMEOUT_MS);
|
||||
if (rc < 0) {
|
||||
endpoint_fini(ep);
|
||||
if (!c)
|
||||
|
|
@ -306,7 +307,8 @@ static int raft_cb_send_pre_vote_request(void *ctx, int peer_idx,
|
|||
endpoint_set_on_connected(ep, on_pre_vote_connected);
|
||||
endpoint_set_err_handler(ep, vote_ep_err_handler);
|
||||
|
||||
int rc = endpoint_connect(ep, peer->hostname, peer->port);
|
||||
int rc = endpoint_connect(ep, peer->hostname, peer->port,
|
||||
DEFAULT_CONNECT_TIMEOUT_MS);
|
||||
if (rc < 0) { endpoint_fini(ep); return 1; }
|
||||
|
||||
rc = iomgr_monitor(ep);
|
||||
|
|
@ -6445,7 +6447,8 @@ static void ha_connect_to_peer(cluster_t *c, int peer_idx)
|
|||
INFO("HA: peer[%d] (%s) not connected — initiating outbound connect (attempt %d)",
|
||||
peer_idx, peer->hostname, n);
|
||||
|
||||
int rc = endpoint_connect(ep, peer->hostname, peer->port);
|
||||
int rc = endpoint_connect(ep, peer->hostname, peer->port,
|
||||
DEFAULT_CONNECT_TIMEOUT_MS);
|
||||
if (rc < 0) {
|
||||
if (should_log)
|
||||
WARN("HA: connect to peer[%d] (%s:%u) failed: %d",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue