diff options
author | Martin Schwenke <martin@meltin.net> | 2015-02-17 15:21:15 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2015-03-23 12:23:12 +0100 |
commit | 876529054a00d107ece720771b11b2403bfa608d (patch) | |
tree | 43f8e67ce50103fbf94d859626f21f44d032a98c /ctdb/tcp | |
parent | db6385afe9a459e109f785167c02fc1fd6064abf (diff) | |
download | samba-876529054a00d107ece720771b11b2403bfa608d.tar.gz |
ctdb-daemon: Set node PNN in one place
This is currently set in 2 places. One of them makes the node loading
code difficult to refactor. Also, when the surrounding code in either
place is touched then it might get broken.
This only needs to be done once at startup, not on every reload. So
do it once in a very obvious way, sacrificing a few CPU cycles for
some added clarity.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tcp')
-rw-r--r-- | ctdb/tcp/tcp_connect.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c index 8a112ff68b8..51aa21fc944 100644 --- a/ctdb/tcp/tcp_connect.c +++ b/ctdb/tcp/tcp_connect.c @@ -385,22 +385,20 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb) strerror(errno), errno)); } } - + if (i == ctdb->num_nodes) { DEBUG(DEBUG_CRIT,("Unable to bind to any of the node addresses - giving up\n")); goto failed; } ctdb->address.address = talloc_strdup(ctdb, ctdb->nodes[i]->address.address); ctdb->address.port = ctdb->nodes[i]->address.port; - ctdb->name = talloc_asprintf(ctdb, "%s:%u", - ctdb->address.address, + ctdb->name = talloc_asprintf(ctdb, "%s:%u", + ctdb->address.address, ctdb->address.port); - ctdb->pnn = ctdb->nodes[i]->pnn; - DEBUG(DEBUG_INFO,("ctdb chose network address %s:%u pnn %u\n", - ctdb->address.address, - ctdb->address.port, - ctdb->pnn)); - + DEBUG(DEBUG_INFO,("ctdb chose network address %s:%u\n", + ctdb->address.address, + ctdb->address.port)); + if (listen(ctcp->listen_fd, 10) == -1) { goto failed; } |