struct ctdb_incoming *in = talloc_get_type(private, struct ctdb_incoming);
char c;
printf("Incoming data\n");
-
+ if (read(in->fd, &c, 1) <= 0) {
+ /* socket is dead */
+ close(in->fd);
+ talloc_free(in);
+ }
}
return 0;
}
+/*
+ check if two addresses are the same
+*/
+static bool ctdb_same_address(struct ctdb_address *a1, struct ctdb_address *a2)
+{
+ return strcmp(a1->address, a2->address) == 0 && a1->port == a2->port;
+}
+
/*
start the protocol going
*/
/* startup connections to the other servers - will happen on
next event loop */
for (node=ctdb->nodes;node;node=node->next) {
+ if (ctdb_same_address(&ctdb->address, &node->address)) continue;
event_add_timed(ctdb->ev, node, timeval_zero(),
ctdb_node_connect, node);
}