summaryrefslogtreecommitdiffstats
path: root/ctdb/tcp/tcp_io.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-12-01 15:54:15 +1100
committerAndrew Tridgell <tridge@samba.org>2006-12-01 15:54:15 +1100
commit35a627cc32ea682beabea577ed481cf41e4b4030 (patch)
tree0fd3c80aec0842aaf897208f651d122eddb121d1 /ctdb/tcp/tcp_io.c
parentec5d2ddd8e860de584fb572bdb46e58422931010 (diff)
downloadsamba-35a627cc32ea682beabea577ed481cf41e4b4030.tar.gz
samba-35a627cc32ea682beabea577ed481cf41e4b4030.tar.xz
samba-35a627cc32ea682beabea577ed481cf41e4b4030.zip
queue up packets to nodes that aren't connected yet. This avoids a
startup race condition in the test suite (This used to be ctdb commit b623ac755de843a3386a7c0e882d651b7f20d482)
Diffstat (limited to 'ctdb/tcp/tcp_io.c')
-rw-r--r--ctdb/tcp/tcp_io.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/ctdb/tcp/tcp_io.c b/ctdb/tcp/tcp_io.c
index 67a6bc4b3b..d572ba533f 100644
--- a/ctdb/tcp/tcp_io.c
+++ b/ctdb/tcp/tcp_io.c
@@ -151,14 +151,9 @@ int ctdb_tcp_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t length)
struct ctdb_tcp_node);
struct ctdb_tcp_packet *pkt;
- if (tnode->fd == -1) {
- ctdb_set_error(node->ctdb, "Sending to dead node %s\n", node->name);
- return -1;
- }
-
/* if the queue is empty then try an immediate write, avoiding
queue overhead. This relies on non-blocking sockets */
- if (tnode->queue == NULL) {
+ if (tnode->queue == NULL && tnode->fd != -1) {
ssize_t n = write(tnode->fd, data, length);
if (n == -1 && errno != EAGAIN && errno != EWOULDBLOCK) {
event_add_timed(node->ctdb->ev, node, timeval_zero(),
@@ -182,7 +177,7 @@ int ctdb_tcp_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t length)
pkt->length = length;
- if (tnode->queue == NULL) {
+ if (tnode->queue == NULL && tnode->fd != -1) {
EVENT_FD_WRITEABLE(tnode->fde);
}