the capture child might not respond shortly after bringing it up (especially it will...
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 25 May 2005 23:28:59 +0000 (23:28 +0000)
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 25 May 2005 23:28:59 +0000 (23:28 +0000)
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

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14436 f5534014-38df-0310-8fa8-9805f1628bb7

capture.c
file.h
gtk/main.c

index db8ff029ef79db21108fbe8edc241b4cc0f463d6..2d8b23c0a82a8492362845357c9d2803625695a8 100644 (file)
--- a/capture.c
+++ b/capture.c
@@ -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;
diff --git a/file.h b/file.h
index 74cc6981b61309895afcf963c88a948288dcc3a5..ce7b1700cdea3453ded85b479bcfa2106c0e93ec 100644 (file)
--- a/file.h
+++ b/file.h
@@ -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,
index 21b838de79629e9824f04495d364453aeba17aae..f23ba8935217e8479c5586de66c33b7b32ce7def 100644 (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;