1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdb-tcp: Factor out function ctdb_tcp_start_outgoing()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Martin Schwenke 2020-03-06 15:59:32 +11:00 committed by Martin Schwenke
parent 2c73dbafba
commit 3c8747fe29

View File

@ -162,11 +162,8 @@ static void ctdb_node_connect_write(struct tevent_context *ev,
/*
called when we should try and establish a tcp connection to a node
*/
void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
struct timeval t, void *private_data)
static void ctdb_tcp_start_outgoing(struct ctdb_node *node)
{
struct ctdb_node *node = talloc_get_type(private_data,
struct ctdb_node);
struct ctdb_tcp_node *tnode = talloc_get_type(node->transport_data,
struct ctdb_tcp_node);
struct ctdb_context *ctdb = node->ctdb;
@ -176,8 +173,6 @@ void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
ctdb_sock_addr sock_out;
int ret;
ctdb_tcp_stop_outgoing(node);
sock_out = node->address;
tnode->out_fd = socket(sock_out.sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
@ -268,6 +263,18 @@ failed:
node);
}
void ctdb_tcp_node_connect(struct tevent_context *ev,
struct tevent_timer *te,
struct timeval t,
void *private_data)
{
struct ctdb_node *node = talloc_get_type_abort(private_data,
struct ctdb_node);
ctdb_tcp_stop_outgoing(node);
ctdb_tcp_start_outgoing(node);
}
/*
called when we get contacted by another node
currently makes no attempt to check if the connection is really from a ctdb