Esempio n. 1
0
gboolean
stop_te_timer(crm_action_timer_t *timer)
{
	const char *timer_desc = "action timer";
	
	if(timer == NULL) {
		return FALSE;
	}
	if(timer->reason == timeout_abort) {
		timer_desc = "global timer";
	}
	
	if(timer->source_id != 0) {
		crm_debug_2("Stopping %s", timer_desc);
		Gmain_timeout_remove(timer->source_id);
		timer->source_id = 0;

	} else {
		return FALSE;
	}

	return TRUE;
}
Esempio n. 2
0
int
remove_msg_rexmit(struct node_info *node, seqno_t seq)
{
	struct rexmit_info ri;
	gpointer value;
	unsigned long sourceid;
			
	ri.seq = seq;
	ri.node =node;
	
	(void)rexmit_hash_table_display;
	value = g_hash_table_lookup(rexmit_hash_table, &ri);
	if (value == NULL){
		cl_log(LOG_ERR, "%s: no entry found in rexmit hash_table for the missing packet(%ld)",
		       __FUNCTION__, seq);
		return HA_FAIL;
	}else {
		sourceid = (unsigned long) value;
		Gmain_timeout_remove(sourceid);
		g_hash_table_remove(rexmit_hash_table, &ri);
	}
	
	return HA_OK;
}
Esempio n. 3
0
gboolean
mon_timer_popped(gpointer data)
{
	int rc = cib_ok;
	int options = cib_scope_local;

	if(timer_id > 0) {
		Gmain_timeout_remove(timer_id);
	}
	
	if(as_console) {
#if CURSES_ENABLED
		move(0, 0);
		printw("Updating...\n");
		clrtoeol();
		refresh();
#endif
		
	} else {
		crm_notice("Updating...");
	}
	
	if(cib_conn == NULL) {
		crm_debug_4("Creating CIB connection");
		cib_conn = cib_new();
	}

	CRM_DEV_ASSERT(cib_conn != NULL);
	if(crm_assert_failed) {
		return FALSE;
		
	} else if(cib_conn->state != cib_connected_query){
		crm_debug_4("Connecting to the CIB");
#if CURSES_ENABLED
		if(as_console) {
			printw("Signing on...\n");
			clrtoeol();
			refresh();
		}
#endif
		if(cib_ok == cib_conn->cmds->signon(
			   cib_conn, crm_system_name, cib_query)) {
			failed_connections = 0;

		} else if (simple_status || one_shot) {
			fprintf(stdout, "Critical: Unable to connect to the CIB\n");
			exit(2);
		} else {
			failed_connections++;
			CRM_DEV_ASSERT(cib_conn->cmds->signoff(cib_conn) == cib_ok);
			wait_for_refresh(0, "Not connected: ", 2*interval);
			return FALSE;
		}
#if CURSES_ENABLED
		if(as_console) {
			printw("Querying...\n");
			clrtoeol();
			refresh();
		}
#endif
	}
	if(as_console) { blank_screen(); }
	rc = cib_conn->cmds->query(cib_conn, NULL, NULL, options);
	add_cib_op_callback(rc, FALSE, NULL, mon_update);
	return FALSE;
}