struct timeval t, void *private_data)
{
int ret;
- struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
- int ctdb_tcp_init(struct ctdb_context *);
+ int i;
- /* shut down the transport */
- if (ctdb->methods != NULL) {
- ctdb->methods->shutdown(ctdb);
- }
+ struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
- /* start the transport again */
ctdb_load_nodes_file(ctdb);
- ret = ctdb_tcp_init(ctdb);
- if (ret != 0) {
- DEBUG(DEBUG_CRIT, (__location__ " Failed to init TCP\n"));
- exit(1);
- }
- if (ctdb->methods == NULL) {
- DEBUG(DEBUG_ALERT,(__location__ " Can not restart transport. ctdb->methods==NULL\n"));
- ctdb_fatal(ctdb, "can not reinitialize transport.");
+ for (i=0; i<ctdb->num_nodes; i++) {
+ if (ctdb->methods->add_node(ctdb->nodes[i]) != 0) {
+ DEBUG(DEBUG_CRIT, (__location__ " methods->add_node failed at %d\n", i));
+ ctdb_fatal(ctdb, "failed to add node. shutting down\n");
+ }
}
- ctdb->methods->initialise(ctdb);
ctdb->methods->start(ctdb);
return;
*/
static int ctdb_tcp_add_node(struct ctdb_node *node)
{
- struct ctdb_tcp *ctcp = talloc_get_type(node->ctdb->private_data,
- struct ctdb_tcp);
struct ctdb_tcp_node *tnode;
- tnode = talloc_zero(ctcp, struct ctdb_tcp_node);
+ tnode = talloc_zero(node, struct ctdb_tcp_node);
CTDB_NO_MEMORY(node->ctdb, tnode);
tnode->fd = -1;
node->private_data = tnode;
- tnode->out_queue = ctdb_queue_setup(node->ctdb, ctcp, tnode->fd, CTDB_TCP_ALIGNMENT,
+ tnode->out_queue = ctdb_queue_setup(node->ctdb, node, tnode->fd, CTDB_TCP_ALIGNMENT,
ctdb_tcp_tnode_cb, node);
return 0;