if(cur_state != S_STARTING && cur_state != S_STOPPING) {
if(cur_state != S_STOPPING) {
do_ccm_update_cache(long long action,		    enum crmd_fsa_cause cause,		    enum crmd_fsa_state cur_state,		    enum crmd_fsa_input current_input,		    fsa_data_t *msg_data){	enum crmd_fsa_input next_input = I_NULL;	unsigned int	lpc;	int		offset;	GHashTable *members = NULL;	oc_ed_t event;	const oc_ev_membership_t *oc = NULL;	oc_node_list_t *tmp = NULL, *membership_copy = NULL;	struct crmd_ccm_data_s *ccm_data = fsa_typed_data(fsa_dt_ccm);	if(ccm_data == NULL) {		crm_err("No data provided to FSA function");		register_fsa_error(C_FSA_INTERNAL, I_FAIL, NULL);		return I_NULL;	}	event = ccm_data->event;	oc = ccm_data->oc;	crm_debug_2("Updating CCM cache after a \"%s\" event.", 		 ccm_event_name(event));	crm_debug_2("instance=%d, nodes=%d, new=%d, lost=%d n_idx=%d, "		  "new_idx=%d, old_idx=%d",		  oc->m_instance,		  oc->m_n_member,		  oc->m_n_in,		  oc->m_n_out,		  oc->m_memb_idx,		  oc->m_in_idx,		  oc->m_out_idx);#define ALAN_DEBUG 1#ifdef ALAN_DEBUG	{		/*		 *	Size	(Size + 2) / 2		 *		 *	3	(3+2)/2	= 5 / 2 = 2		 *	4	(4+2)/2	= 6 / 2 = 3		 *	5	(5+2)/2	= 7 / 2 = 3		 *	6	(6+2)/2	= 8 / 2 = 4		 *	7	(7+2)/2	= 9 / 2 = 4		 */		unsigned int		clsize = (oc->m_out_idx - oc->m_n_member);		unsigned int		plsize = (clsize + 2)/2;		gboolean	plurality = (oc->m_n_member >= plsize);		gboolean	Q = ccm_have_quorum(event);		if(clsize == 2) {			if (!Q) {				crm_err("2 nodes w/o quorum");			}					} else if(Q && !plurality) {			crm_err("Quorum w/o plurality (%d/%d nodes)",				oc->m_n_member, clsize);		} else if(plurality && !Q) {			crm_err("Plurality w/o Quorum (%d/%d nodes)",				oc->m_n_member, clsize);		} else {			crm_debug_2("Quorum(%s) and plurality (%d/%d) agree.",				    Q?"true":"false", oc->m_n_member, clsize);		}			}#endif			crm_malloc0(membership_copy, sizeof(oc_node_list_t));	if(membership_copy == NULL) {		crm_crit("Couldnt create membership copy - out of memory");		register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);		return I_NULL;	}	membership_copy->id = oc->m_instance;	membership_copy->last_event = event;	crm_debug_3("Copying members");	/*--*-- All Member Nodes --*--*/	offset = oc->m_memb_idx;	membership_copy->members_size = oc->m_n_member;	if(membership_copy->members_size > 0) {		membership_copy->members =			g_hash_table_new(g_str_hash, g_str_equal);		members = membership_copy->members;				for(lpc=0; lpc < membership_copy->members_size; lpc++) {			oc_node_t *member = NULL;			crm_debug_3("Copying member %d", lpc);			crm_malloc0(member, sizeof(oc_node_t));						if(member == NULL) {				continue;			}			member->node_id =				oc->m_array[offset+lpc].node_id;						member->node_born_on =				oc->m_array[offset+lpc].node_born_on;						member->node_uname = NULL;			if(oc->m_array[offset+lpc].node_uname != NULL) {				member->node_uname =					crm_strdup(oc->m_array[offset+lpc].node_uname);			} else {				crm_err("Node %d had a NULL uname",					member->node_id);			}			g_hash_table_insert(				members, member->node_uname, member);			}			} else {		membership_copy->members = NULL;	}		crm_debug_3("Copying new members");	/*--*-- New Member Nodes --*--*/	offset = oc->m_in_idx;	membership_copy->new_members_size = oc->m_n_in;	if(membership_copy->new_members_size > 0) {		membership_copy->new_members =			g_hash_table_new(g_str_hash, g_str_equal);		members = membership_copy->new_members;				for(lpc=0; lpc < membership_copy->new_members_size; lpc++) {			oc_node_t *member = NULL;			crm_malloc0(member, sizeof(oc_node_t));			if(member == NULL) {				continue;			}						member->node_uname = NULL;			member->node_id = oc->m_array[offset+lpc].node_id;			member->node_born_on =				oc->m_array[offset+lpc].node_born_on;			if(oc->m_array[offset+lpc].node_uname != NULL) {				member->node_uname =					crm_strdup(oc->m_array[offset+lpc].node_uname);			} else {				crm_err("Node %d had a NULL uname",					member->node_id);			}			g_hash_table_insert(				members, member->node_uname, member);				g_hash_table_insert(members, member->node_uname, member);		}	} else {		membership_copy->new_members = NULL;	}		crm_debug_3("Copying dead members");	/*--*-- Recently Dead Member Nodes --*--*/	offset = oc->m_out_idx;	membership_copy->dead_members_size = oc->m_n_out;	if(membership_copy->dead_members_size > 0) {		membership_copy->dead_members =			g_hash_table_new(g_str_hash, g_str_equal);		members = membership_copy->dead_members;		for(lpc=0; lpc < membership_copy->dead_members_size; lpc++) {			oc_node_t *member = NULL;			crm_malloc0(member, sizeof(oc_node_t));			if(member == NULL) {				continue;			}						member->node_id =				oc->m_array[offset+lpc].node_id;						member->node_born_on =				oc->m_array[offset+lpc].node_born_on;						member->node_uname = NULL;			CRM_DEV_ASSERT(oc->m_array[offset+lpc].node_uname != NULL);						if(oc->m_array[offset+lpc].node_uname == NULL) {				continue;			}						member->node_uname =				crm_strdup(oc->m_array[offset+lpc].node_uname);			g_hash_table_insert(				members, member->node_uname, member);				g_hash_table_insert(members, member->node_uname, member);		}	} else {		membership_copy->dead_members = NULL;	}	tmp = fsa_membership_copy;	fsa_membership_copy = membership_copy;	crm_debug_2("Updated membership cache with %d (%d new, %d lost) members",		    g_hash_table_size(fsa_membership_copy->members),		    g_hash_table_size(fsa_membership_copy->new_members),		    g_hash_table_size(fsa_membership_copy->dead_members));		/* Free the old copy */	if(tmp != NULL) {		if(tmp->members != NULL)			g_hash_table_foreach_remove(				tmp->members, ghash_node_clfree, NULL);		if(tmp->new_members != NULL)			g_hash_table_foreach_remove(				tmp->new_members, ghash_node_clfree, NULL);		if(tmp->dead_members != NULL)			g_hash_table_foreach_remove(				tmp->dead_members, ghash_node_clfree, NULL);		crm_free(tmp);	}	crm_debug_3("Free'd old copies");	set_bit_inplace(fsa_input_register, R_CCM_DATA);	if(cur_state != S_STARTING && cur_state != S_STOPPING) {		crm_debug_3("Updating the CIB from CCM cache");		do_update_cib_nodes(NULL, FALSE);	}		return next_input;}