} else if(client->replace && is_replace) { do_send = TRUE;
cib_notify_client(gpointer key, gpointer value, gpointer user_data){	IPC_Channel *ipc_client = NULL;	HA_Message *update_msg = user_data;	cib_client_t *client = value;	const char *type = NULL;	gboolean is_pre = FALSE;	gboolean is_post = FALSE;		gboolean is_confirm = FALSE;	gboolean is_diff = FALSE;	gboolean do_send = FALSE;	int qlen = 0;	int max_qlen = 0;		CRM_DEV_ASSERT(client != NULL);	CRM_DEV_ASSERT(update_msg != NULL);	type = cl_get_string(update_msg, F_SUBTYPE);	CRM_DEV_ASSERT(type != NULL);	if(client == NULL) {		crm_warn("Skipping NULL client");		return;	} else if(client->channel == NULL) {		crm_warn("Skipping client with NULL channel");		return;	} else if(client->name == NULL) {		crm_debug_2("Skipping unnammed client / comamnd channel");		return;	}		if(safe_str_eq(type, T_CIB_PRE_NOTIFY)) {		is_pre = TRUE;			} else if(safe_str_eq(type, T_CIB_POST_NOTIFY)) {		is_post = TRUE;	} else if(safe_str_eq(type, T_CIB_UPDATE_CONFIRM)) {		is_confirm = TRUE;	} else if(safe_str_eq(type, T_CIB_DIFF_NOTIFY)) {		is_diff = TRUE;	}	ipc_client = client->channel;	qlen = ipc_client->send_queue->current_qlen;	max_qlen = ipc_client->send_queue->max_qlen;		if(ipc_client->ops->get_chan_status(ipc_client) != IPC_CONNECT) {		crm_debug("Skipping notification to disconnected"			  " client %s/%s", client->name, client->id);	} else if(client->pre_notify && is_pre) {		if(qlen < (int)(0.4 * max_qlen)) {			do_send = TRUE;		} else {			crm_warn("Throttling pre-notifications due to"				 " high load: queue=%d (max=%d)",				 qlen, max_qlen);		}		 	} else if(client->post_notify && is_post) {		if(qlen < (int)(0.7 * max_qlen)) {			do_send = TRUE;		} else {			crm_warn("Throttling post-notifications due to"				 " extreme load: queue=%d (max=%d)",				 qlen, max_qlen);		}		/* these are critical */	} else if(client->diffs && is_diff) {		do_send = TRUE;	} else if(client->confirmations && is_confirm) {		do_send = TRUE;	}	if(do_send) {		crm_debug_2("Notifying client %s/%s of %s update (queue=%d)",			    client->name, client->channel_name, type, qlen);		if(ipc_client->send_queue->current_qlen >= ipc_client->send_queue->max_qlen) {			/* We never want the CIB to exit because our client is slow */			crm_crit("%s-notification of client %s/%s failed - queue saturated",				 is_confirm?"Confirmation":is_post?"Post":"Pre",				 client->name, client->id);					} else {			HA_Message *msg_copy = ha_msg_copy(update_msg);			if(crm_send_ipc_message(				   ipc_client, msg_copy, TRUE) == FALSE) {				crm_warn("Notification of client %s/%s failed",					 client->name, client->id);			}		}			} else {		crm_debug_3("Client %s/%s not interested in %s notifications",			    client->name, client->channel_name, type);		}}