the capture child might not respond shortly after bringing it up (especially it will block, if no input coming from an input capture pipe (e.g. mkfifo) is coming in)

to prevent problems, bring the main GUI into "capture mode" right after successfully spawn/exec the capture child, without waiting for any response from it

svn path=/trunk/; revision=14436
This commit is contained in:
Ulf Lamping 2005-05-25 23:28:59 +00:00
parent b3b72959a2
commit 351214282d
3 changed files with 29 additions and 12 deletions

View File

@ -98,6 +98,13 @@ capture_start(capture_options *capture_opts)
}
capture_opts->state = CAPTURE_STOPPED;
} else {
/* the capture child might not respond shortly after bringing it up */
/* (especially it will block, if no input coming from an input capture pipe (e.g. mkfifo) is coming in) */
/* to prevent problems, bring the main GUI into "capture mode" right after successfully */
/* spawn/exec the capture child, without waiting for any response from it */
cf_callback_invoke(cf_cb_live_capture_prepared, capture_opts);
}
return ret;

1
file.h
View File

@ -60,6 +60,7 @@ typedef enum {
cf_cb_file_read_start,
cf_cb_file_read_finished,
#ifdef HAVE_LIBPCAP
cf_cb_live_capture_prepared,
cf_cb_live_capture_update_started,
cf_cb_live_capture_update_continue,
cf_cb_live_capture_update_finished,

View File

@ -1289,9 +1289,8 @@ main_cf_cb_file_read_finished(capture_file *cf)
#ifdef HAVE_LIBPCAP
static void
main_cf_cb_live_capture_update_started(capture_options *capture_opts)
main_cf_cb_live_capture_prepared(capture_options *capture_opts)
{
gchar *capture_msg;
gchar *title;
@ -1308,10 +1307,25 @@ main_cf_cb_live_capture_update_started(capture_options *capture_opts)
a capture. */
set_menus_for_capture_in_progress(TRUE);
/* update statusbar */
statusbar_push_file_msg("Waiting for capture input data ...");
/* Don't set up main window for a capture file. */
main_set_for_capture_file(FALSE);
}
static void
main_cf_cb_live_capture_update_started(capture_options *capture_opts)
{
gchar *capture_msg;
/* Enable menu items that make sense if you have some captured
packets (yes, I know, we don't have any *yet*). */
set_menus_for_captured_packets(TRUE);
statusbar_pop_file_msg();
capture_msg = g_strdup_printf(" %s: <live capture in progress> to file: %s",
get_interface_descriptive_name(capture_opts->iface),
(capture_opts->save_file) ? capture_opts->save_file : "");
@ -1377,22 +1391,14 @@ static void
main_cf_cb_live_capture_fixed_started(capture_options *capture_opts)
{
gchar *capture_msg;
gchar *title;
title = g_strdup_printf("%s: Capturing - Ethereal",
get_interface_descriptive_name(capture_opts->iface));
set_main_window_name(title);
g_free(title);
/* Disable menu items that make no sense if you're currently running
a capture. */
set_menus_for_capture_in_progress(TRUE);
/* Enable menu items that make sense if you have some captured
packets (yes, I know, we don't have any *yet*). */
/*set_menus_for_captured_packets(TRUE);*/
statusbar_pop_file_msg();
capture_msg = g_strdup_printf(" %s: <live capture in progress> to file: %s",
get_interface_descriptive_name(capture_opts->iface),
(capture_opts->save_file) ? capture_opts->save_file : "");
@ -1505,6 +1511,9 @@ void main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
main_cf_cb_file_read_finished(data);
break;
#ifdef HAVE_LIBPCAP
case(cf_cb_live_capture_prepared):
main_cf_cb_live_capture_prepared(data);
break;
case(cf_cb_live_capture_update_started):
main_cf_cb_live_capture_update_started(data);
break;