channel->ops->set_send_qlen(channel, 200);
channel->ops->set_send_qlen(channel, 400);
cib_client_connect(IPC_Channel *channel, gpointer user_data){	gboolean auth_failed = FALSE;	gboolean can_connect = TRUE;	gboolean (*client_callback)(IPC_Channel *channel, gpointer user_data) = NULL;	cib_client_t *new_client = NULL;	crm_devel("Connecting channel");	if (channel == NULL) {		crm_err("Channel was NULL");		can_connect = FALSE;			} else if (channel->ch_status == IPC_DISCONNECT) {		crm_err("Channel was disconnected");		can_connect = FALSE;			} else if(user_data == NULL) {		crm_err("user_data must contain channel name");		can_connect = FALSE;			} else {		crm_malloc(new_client, sizeof(cib_client_t));		new_client->id          = NULL;		new_client->callback_id = NULL;		new_client->source      = NULL;		new_client->channel     = channel;		new_client->channel_name = user_data;		new_client->delegated_calls = NULL;		crm_devel("Created channel %p for channel %s",			  new_client, new_client->channel_name);				client_callback = NULL;				/* choose callback and do auth based on channel_name */		if(safe_str_eq(new_client->channel_name, cib_channel_callback)) {			client_callback = cib_null_callback;		} else {			uuid_t client_id;			uuid_generate(client_id);			crm_malloc(new_client->id, sizeof(char)*36);			uuid_unparse(client_id, new_client->id);			new_client->id[35] = EOS;						uuid_generate(client_id);			crm_malloc(new_client->callback_id, sizeof(char)*36);			uuid_unparse(client_id, new_client->callback_id);			new_client->callback_id[35] = EOS;						client_callback = cib_ro_callback;			if(safe_str_eq(new_client->channel_name, cib_channel_rw)) {				client_callback = cib_rw_callback;			} 		}	}	if(auth_failed) {		crm_err("Connection to %s channel failed authentication",			(char *)user_data);		can_connect = FALSE;	}	if(can_connect == FALSE) {		if(new_client) {			crm_free(new_client->id);			crm_free(new_client->callback_id);		}		crm_free(new_client);		return FALSE;	}		channel->ops->set_recv_qlen(channel, 100);	if(safe_str_eq(new_client->channel_name, cib_channel_callback)) {		channel->ops->set_send_qlen(channel, 200);	} else {		channel->ops->set_send_qlen(channel, 100);	}			if(client_callback != NULL) {		new_client->source = G_main_add_IPC_Channel(			G_PRIORITY_LOW, channel, FALSE, client_callback,			new_client, default_ipc_connection_destroy);	}	if(client_callback != cib_null_callback) {		/* send msg to client with uuid to use when signing up for		 * callback channel		 */		HA_Message *reg_msg = ha_msg_new(3);		ha_msg_add(reg_msg, F_CIB_OPERATION, CRM_OP_REGISTER);		ha_msg_add(reg_msg, F_CIB_CLIENTID,  new_client->id);		ha_msg_add(			reg_msg, F_CIB_CALLBACK_TOKEN, new_client->callback_id);				send_ipc_message(channel, reg_msg);				/* make sure we can find ourselves later for sync calls		 * redirected to the master instance		 */		g_hash_table_insert(client_list, new_client->id, new_client);	}	crm_devel("Channel %s connected for client %s",		  new_client->channel_name, new_client->id);		return TRUE;}