diff options
author | Martin Schwenke <martin@meltin.net> | 2012-12-03 15:44:12 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2013-01-07 10:35:39 +1100 |
commit | 80a2bb84e7d04f4ee3b3369f734b80dce184ad72 (patch) | |
tree | ab383d6b07995496b884cfa754048d0894865df5 /ctdb/tcp | |
parent | 5cf98c80ff7bc3814e5a052bd21ee51172dcb02c (diff) | |
download | samba-80a2bb84e7d04f4ee3b3369f734b80dce184ad72.tar.gz |
ctdbd: Remove debug option --node-ip, use --listen instead
This effectively reverts d96cb02c2c24f9eabbc53d3d38e90dea49cff3e0
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit 496387a585b2c5778c808cf02b8e1435abde4c3e)
Diffstat (limited to 'ctdb/tcp')
-rw-r--r-- | ctdb/tcp/tcp_connect.c | 58 |
1 files changed, 21 insertions, 37 deletions
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c index c94b88f6709..26a280e30ba 100644 --- a/ctdb/tcp/tcp_connect.c +++ b/ctdb/tcp/tcp_connect.c @@ -290,45 +290,32 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb) return -1; } - /* We only need to serialize this if we dont yet know the node ip */ - if (!ctdb->node_ip) { - /* in order to ensure that we don't get two nodes with the - same adddress, we must make the bind() and listen() calls - atomic. The SO_REUSEADDR setsockopt only prevents double - binds if the first socket is in LISTEN state */ - lock_fd = open(lock_path, O_RDWR|O_CREAT, 0666); - if (lock_fd == -1) { - DEBUG(DEBUG_CRIT,("Unable to open %s\n", lock_path)); - return -1; - } + /* in order to ensure that we don't get two nodes with the + same adddress, we must make the bind() and listen() calls + atomic. The SO_REUSEADDR setsockopt only prevents double + binds if the first socket is in LISTEN state */ + lock_fd = open(lock_path, O_RDWR|O_CREAT, 0666); + if (lock_fd == -1) { + DEBUG(DEBUG_CRIT,("Unable to open %s\n", lock_path)); + return -1; + } - lock.l_type = F_WRLCK; - lock.l_whence = SEEK_SET; - lock.l_start = 0; - lock.l_len = 1; - lock.l_pid = 0; + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + lock.l_start = 0; + lock.l_len = 1; + lock.l_pid = 0; - if (fcntl(lock_fd, F_SETLKW, &lock) != 0) { - DEBUG(DEBUG_CRIT,("Unable to lock %s\n", lock_path)); - close(lock_fd); - return -1; - } + if (fcntl(lock_fd, F_SETLKW, &lock) != 0) { + DEBUG(DEBUG_CRIT,("Unable to lock %s\n", lock_path)); + close(lock_fd); + return -1; } for (i=0; i < ctdb->num_nodes; i++) { if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) { continue; } - - /* if node_ip is specified we will only try to bind to that - ip. - */ - if (ctdb->node_ip != NULL) { - if (strcmp(ctdb->node_ip, ctdb->nodes[i]->address.address)) { - continue; - } - } - ZERO_STRUCT(sock); if (ctdb_tcp_get_address(ctdb, ctdb->nodes[i]->address.address, @@ -411,15 +398,12 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb) ctdb_listen_event, ctdb); tevent_fd_set_auto_close(fde); - if (!ctdb->node_ip) { - close(lock_fd); - } + close(lock_fd); + return 0; failed: - if (!ctdb->node_ip) { - close(lock_fd); - } + close(lock_fd); close(ctcp->listen_fd); ctcp->listen_fd = -1; return -1; |