transition_timer->timeout = local_transition_timeout;
transition_timer->timeout = next_transition_timeout;
process_graph_event(xmlNodePtr event){	int lpc = 0, lpc2 = 0;	int local_transition_timeout = transition_timeout;	int action_id          = -1;	int op_status_i        = 0;	gboolean complete      = TRUE;	const char *op_status  = xmlGetProp(event, XML_LRM_ATTR_OPSTATUS);		if(op_status != NULL) {		op_status_i = atoi(op_status);	}		if(op_status_i == -1) {		/* just information that the action was sent */		crm_trace("Ignoring TE initiated updates");		return TRUE;	}	slist_iter(		synapse, synapse_t, graph, lpc,		/* lookup event */		slist_iter(			action, action_t, synapse->actions, lpc2,			action_id = match_graph_event(action, event);			if(action_id != -1) {				break;			}			);		if(action_id != -1) {			break;		}		);		if(action_id > -1) {		crm_xml_devel(event, "Event found");			} else if(action_id == -2) {		crm_xml_info(event, "Event found but failed");			} else if(event != NULL) {		/* unexpected event, trigger a pe-recompute */		/* possibly do this only for certain types of actions */		send_abort("Event not matched", event);		return FALSE;/*	} else { we dont care, a transition is starting */	}		/* something happened, stop the timer and start it again at the end */	stop_te_timer(transition_timer);		slist_iter(		synapse, synapse_t, graph, lpc,				gboolean prereqs_complete = TRUE;		if(synapse->confirmed) {			crm_debug("Skipping confirmed synapse %d", synapse->id);			continue;					} else if(synapse->complete == FALSE) {			crm_debug("Checking pre-reqs for %d", synapse->id);			/* lookup prereqs */			slist_iter(				prereq, action_t, synapse->inputs, lpc2,								crm_devel("Processing input %d", prereq->id);								if(prereq->id == action_id) {					crm_devel("Marking input %d complete",						  action_id);					prereq->complete = TRUE;									} else if(prereq->complete == FALSE) {					crm_devel("Inputs for synapse %d not satisfied",						  synapse->id);					prereqs_complete = FALSE;				}								);		}				crm_debug("Initiating outstanding actions for %d", synapse->id);		if(synapse->complete) {			crm_debug("Skipping complete synapse %d", synapse->id);				} else if(prereqs_complete) {			crm_devel("All inputs for synapse %d satisfied..."				  " invoking actions", synapse->id);			slist_iter(				action, action_t, synapse->actions, lpc2,				/* allow some leway */				int tmp_time = 2 * action->timeout;				gboolean passed = FALSE;				action->invoked = TRUE;				/* Invoke the action and start the timer */				passed = initiate_action(action);				if(passed == FALSE) {					crm_err("Failed initiating "						"<%s id=%d> in synapse %d",						action->xml->name, action->id,						synapse->id);					send_abort("Action init failed",						   action->xml);					break;				} 				if(tmp_time > local_transition_timeout) {					local_transition_timeout = tmp_time;				}							);			synapse->complete = TRUE;			crm_debug("Synapse %d complete", synapse->id);		}				crm_debug("Checking if %d is confirmed", synapse->id);		if(synapse->complete == FALSE) {			crm_debug("Found an incomplete synapse"				  " - transition not complete");			/* indicate that the transition is not yet complete */			complete = FALSE;					} else if(synapse->confirmed == FALSE) {			synapse->confirmed = TRUE;			slist_iter(				action, action_t, synapse->actions, lpc2,								if(action->type == action_type_rsc				   && action->complete == FALSE) {					complete = FALSE;					synapse->confirmed = FALSE;					crm_debug("Found an incomplete action"						  " - transition not complete");					break;				}				);		}		crm_debug("%d is %s",			  synapse->id,			  synapse->confirmed?"confirmed":synapse->complete?"complete":"pending");		);	if(complete) {		/* allow some slack until we are pretty sure nothing		 * else is happening		 */		crm_info("Transition complete");		print_state(TRUE);				if(transition_fuzz_timer->timeout > 0) {			crm_info("Allowing the system to stabilize for %d ms"				 " before S_IDLE transition",				 transition_fuzz_timer->timeout);			start_te_timer(transition_fuzz_timer);					} else {			send_success("complete");		}			} else {		/* restart the transition timer again */		crm_info("Transition not yet complete");		print_state(TRUE);		transition_timer->timeout = local_transition_timeout;		start_te_timer(transition_timer);	}			return TRUE;}