Qt: fix Diameter SRT statistics display
authorPascal Quantin <pascal.quantin@gmail.com>
Sat, 9 Sep 2017 20:49:45 +0000 (22:49 +0200)
committerAnders Broman <a.broman58@gmail.com>
Mon, 11 Sep 2017 05:05:45 +0000 (05:05 +0000)
Diameter dynamically create the SRT entries during runtime.
Delay the SRT table addition to the end of dissection to properly handle
this use case.

Bug: 13442
Change-Id: Id498f8d9bb4a1d7c632c9a556239bf74d0530f2a
Reviewed-on: https://code.wireshark.org/review/23443
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
ui/qt/service_response_time_dialog.cpp
ui/qt/service_response_time_dialog.h

index 9b4ef6365d94c4396cf7e19fc9bf650cc9a2d75c..b9128e0b65d92cd835807611b46d52f5386b26f2 100644 (file)
@@ -233,10 +233,6 @@ void ServiceResponseTimeDialog::tapReset(void *srtd_ptr)
     reset_srt_table(srtd->srt_array, NULL, NULL);
 
     srt_dlg->statsTreeWidget()->clear();
-    for (guint i = 0; i < srtd->srt_array->len; i++) {
-        srt_stat_table *srt_table = g_array_index(srtd->srt_array, srt_stat_table*, i);
-        srt_dlg->addSrtTable(srt_table);
-    }
 }
 
 void ServiceResponseTimeDialog::tapDraw(void *srtd_ptr)
@@ -259,17 +255,25 @@ void ServiceResponseTimeDialog::tapDraw(void *srtd_ptr)
     }
 }
 
+void ServiceResponseTimeDialog::endRetapPackets()
+{
+    for (guint i = 0; i < srt_data_.srt_array->len; i++) {
+        srt_stat_table *srt_table = g_array_index(srt_data_.srt_array, srt_stat_table*, i);
+        addSrtTable(srt_table);
+    }
+    WiresharkDialog::endRetapPackets();
+}
+
 void ServiceResponseTimeDialog::fillTree()
 {
-    srt_data_t srt_data;
-    srt_data.srt_array = g_array_new(FALSE, TRUE, sizeof(srt_stat_table*));
-    srt_data.user_data = this;
+    srt_data_.srt_array = g_array_new(FALSE, TRUE, sizeof(srt_stat_table*));
+    srt_data_.user_data = this;
 
-    srt_table_dissector_init(srt_, srt_data.srt_array, NULL, NULL);
+    srt_table_dissector_init(srt_, srt_data_.srt_array, NULL, NULL);
 
     QString display_filter = displayFilter();
     if (!registerTapListener(get_srt_tap_listener_name(srt_),
-                        &srt_data,
+                        &srt_data_,
                         display_filter.toUtf8().constData(),
                         0,
                         tapReset,
@@ -288,14 +292,14 @@ void ServiceResponseTimeDialog::fillTree()
         statsTreeWidget()->setRootIndex(statsTreeWidget()->model()->index(0, 0));
     }
 
-    tapDraw(&srt_data);
+    tapDraw(&srt_data_);
 
     statsTreeWidget()->sortItems(SRT_COLUMN_PROCEDURE, Qt::AscendingOrder);
     statsTreeWidget()->setSortingEnabled(true);
 
     removeTapListeners();
 
-    g_array_free(srt_data.srt_array, TRUE);
+    g_array_free(srt_data_.srt_array, TRUE);
 }
 
 QList<QVariant> ServiceResponseTimeDialog::treeItemData(QTreeWidgetItem *ti) const
index 9722141d87d3fb9c5be24deb7a1616c793eeef6e..f3273ac6ea558f62e8d171e30f5bf90307352d8f 100644 (file)
@@ -23,6 +23,7 @@
 #define __SERVICE_RESPONSE_TIME_DIALOG_H__
 
 #include "tap_parameter_dialog.h"
+#include <epan/srt_table.h>
 
 struct register_srt;
 struct _srt_stat_table;
@@ -37,6 +38,9 @@ public:
     ServiceResponseTimeDialog(QWidget &parent, CaptureFile &cf, struct register_srt *srt, const QString filter, int help_topic = 0);
     static TapParameterDialog *createSrtDialog(QWidget &parent, const QString cfg_str, const QString filter, CaptureFile &cf);
 
+public slots:
+    void endRetapPackets();
+
 protected:
     struct register_srt *srt_;
 
@@ -61,6 +65,8 @@ private:
     virtual QList<QVariant> treeItemData(QTreeWidgetItem *ti) const;
     virtual const QString filterExpression();
 
+    srt_data_t srt_data_;
+
 private slots:
     void statsTreeWidgetItemChanged();
 };