예제 #1
0
/* Ping callbacks */
void
on_ping_activate (GtkWidget * widget, gpointer data)
{
	Netinfo *pinger = data;
	GtkEntry *entry_host;
	gchar *text;

	g_return_if_fail (pinger != NULL);

	if (pinger->running) {
		ping_stop (pinger);
	} else {
		if (netinfo_validate_host (pinger)) {
			entry_host = GTK_ENTRY (
				gtk_bin_get_child (GTK_BIN (pinger->host)));
			text = g_strdup (gtk_entry_get_text (entry_host));
			
			gn_combo_history_add (pinger->history, text);
			
			g_free (text);
			
			ping_do (pinger);
		}
	}
}
예제 #2
0
    void ping_cb(viewid_t vid, ref<ping_res> resp, clnt_stat stat) {
	if (view_.vid != vid)
	    return;

	if (stat) {
	    ping_stop();
	    view_is_down();
	    return;
	}

	if (!resp->ok) {
	    /*
	     * This is in case we're fetching logs from the new primary,
	     * and we're stepping through a number of views quickly.
	     * Timeout will reset us only if we fail to reach the final
	     * view within periodic_primary_ping.
	     */
	    ping_stop();
	    ping_timeout_cb_ =
		delaycb(periodic_primary_ping,
			wrap(mkref(this), &cohort::view_is_down));
	}
    }
예제 #3
0
    void ping_restart() {
	ping_stop();
	ping_start();
    }