aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2019-02-19 19:02:30 +0100
committerAnders Broman <a.broman58@gmail.com>2019-02-20 04:23:42 +0000
commit07c73adaee2313e4c8e289212d048bdc013c0075 (patch)
treeb653c3dec8b69e6c8760aa9628e89f49a6fe3574
parent1df39d65f567803929f4b009409f872cd7c46622 (diff)
Qt: Fix restart capture when using a ring buffer
Set capture_opts->restart before restart current capture. Update the restart handling in capture_input_closed() to not remove the current save file; this is either the last file in a ring buffer or a temporary file which will be reused later. Also remove the code which starts the capture again because this is now done in MainWindow::on_actionCaptureRestart_triggered(). Keep the code to restore the original save file when having a ring buffer. This will avoid the error message "Ring buffer requested, but capture isn't being saved to a permanent file" and a following unwanted capture stop. This fix will also avoid the "No packets captured" warning when restart capture without having any packets captured. Remove the unused capture_restart() function which was used in GTK. Change-Id: I80802217b71810eaa36b78a2eb4c32697ddc92ce Reviewed-on: https://code.wireshark.org/review/32110 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--ui/capture.c30
-rw-r--r--ui/capture.h4
-rw-r--r--ui/qt/main_window_slots.cpp2
3 files changed, 1 insertions, 35 deletions
diff --git a/ui/capture.c b/ui/capture.c
index eabf92bc1c..0ecebde116 100644
--- a/ui/capture.c
+++ b/ui/capture.c
@@ -179,18 +179,6 @@ capture_stop(capture_session *cap_session)
void
-capture_restart(capture_session *cap_session)
-{
- capture_options *capture_opts = cap_session->capture_opts;
-
- g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Restart");
-
- capture_opts->restart = TRUE;
- capture_stop(cap_session);
-}
-
-
-void
capture_kill_child(capture_session *cap_session)
{
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_INFO, "Capture Kill");
@@ -732,30 +720,12 @@ capture_input_closed(capture_session *cap_session, gchar *msg)
if(capture_opts->restart) {
capture_opts->restart = FALSE;
- ws_unlink(capture_opts->save_file);
-
/* If we have a ring buffer, the original save file has been overwritten
with the "ring filename". Restore it before starting again */
if ((capture_opts->multi_files_on) && (capture_opts->orig_save_file != NULL)) {
g_free(capture_opts->save_file);
capture_opts->save_file = g_strdup(capture_opts->orig_save_file);
}
-
- /* if it was a tempfile, throw away the old filename (so it will become a tempfile again) */
- if(cf_is_tempfile((capture_file *)cap_session->cf)) {
- g_free(capture_opts->save_file);
- capture_opts->save_file = NULL;
- }
-
- /* ... and start the capture again */
- if (capture_opts->ifaces->len == 0) {
- collect_ifaces(capture_opts);
- }
-
- /* close the currently loaded capture file */
- cf_close((capture_file *)cap_session->cf);
-
- capture_start(capture_opts, cap_session, cap_session->cap_data_info, NULL); /*XXX is this NULL ok or we need an update_cb???*/
} else {
/* We're not doing a capture any more, so we don't have a save file. */
g_free(capture_opts->save_file);
diff --git a/ui/capture.h b/ui/capture.h
index d4de9efe09..0494878267 100644
--- a/ui/capture.h
+++ b/ui/capture.h
@@ -62,10 +62,6 @@ capture_start(capture_options *capture_opts, capture_session *cap_session, info_
extern void
capture_stop(capture_session *cap_session);
-/** Restart the current captured packets and start again. */
-extern void
-capture_restart(capture_session *cap_session);
-
/** Terminate the capture child cleanly when exiting. */
extern void
capture_kill_child(capture_session *cap_session);
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index b3bdcacf0b..8358db011d 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -3616,10 +3616,10 @@ void MainWindow::on_actionCaptureStop_triggered()
void MainWindow::on_actionCaptureRestart_triggered()
{
QString before_what(tr(" before restarting the capture"));
+ cap_session_.capture_opts->restart = TRUE;
if (!testCaptureFileClose(before_what, Restart))
return;
-/* TODO: GTK use only this: capture_restart(&cap_session_); */
startCapture();
}