VoIP: VoIP calls statistics are cleared when retap is issued

Every press of Play Stream or Prepare Filter caused incorrect increasing
of Packets count and added Comments.
The reason was that callinfo statistics were not clear before recap
therefore all new values were added to exiting ones.
Patch solves it.
This commit is contained in:
Jirka Novak 2020-12-13 14:04:11 +01:00 committed by AndersBroman
parent 6048e027ec
commit ff3fffcf5c
5 changed files with 20 additions and 5 deletions

View File

@ -198,6 +198,13 @@ void VoipCallsInfoModel::updateCalls(GQueue *callsinfos)
} }
} }
void VoipCallsInfoModel::removeAllCalls()
{
beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
callinfos_.clear();
endRemoveRows();
}
// Proxy model that allows columns to be sorted. // Proxy model that allows columns to be sorted.
VoipCallsInfoSortedModel::VoipCallsInfoSortedModel(QObject *parent) : VoipCallsInfoSortedModel::VoipCallsInfoSortedModel(QObject *parent) :

View File

@ -33,6 +33,7 @@ public:
void setTimeOfDay(bool timeOfDay); void setTimeOfDay(bool timeOfDay);
bool timeOfDay() const; bool timeOfDay() const;
void updateCalls(GQueue *callsinfos); void updateCalls(GQueue *callsinfos);
void removeAllCalls();
static voip_calls_info_t *indexToCallInfo(const QModelIndex &index); static voip_calls_info_t *indexToCallInfo(const QModelIndex &index);

View File

@ -81,6 +81,7 @@ VoipCallsDialog::VoipCallsDialog(QWidget &parent, CaptureFile &cf, bool all_flow
memset (&tapinfo_, 0, sizeof(tapinfo_)); memset (&tapinfo_, 0, sizeof(tapinfo_));
tapinfo_.tap_packet = tapPacket; tapinfo_.tap_packet = tapPacket;
tapinfo_.tap_reset = tapReset;
tapinfo_.tap_draw = tapDraw; tapinfo_.tap_draw = tapDraw;
tapinfo_.tap_data = this; tapinfo_.tap_data = this;
tapinfo_.callsinfos = g_queue_new(); tapinfo_.callsinfos = g_queue_new();
@ -176,10 +177,13 @@ void VoipCallsDialog::changeEvent(QEvent *event)
QDialog::changeEvent(event); QDialog::changeEvent(event);
} }
//void VoipCallsDialog::tapReset(void *) void VoipCallsDialog::tapReset(void *tapinfo_ptr)
//{ {
// voip_calls_tapinfo_t *tapinfo = (voip_calls_tapinfo_t *) tapinfo_ptr; voip_calls_tapinfo_t *tapinfo = static_cast<voip_calls_tapinfo_t *>(tapinfo_ptr);
//} VoipCallsDialog *voip_calls_dialog = static_cast<VoipCallsDialog *>(tapinfo->tap_data);
voip_calls_dialog->call_infos_model_->removeAllCalls();
voip_calls_reset_all_taps(tapinfo);
}
tap_packet_status VoipCallsDialog::tapPacket(void *, packet_info *, epan_dissect_t *, const void *) tap_packet_status VoipCallsDialog::tapPacket(void *, packet_info *, epan_dissect_t *, const void *)
{ {

View File

@ -68,7 +68,7 @@ private:
bool voip_calls_tap_listeners_removed_; bool voip_calls_tap_listeners_removed_;
// Tap callbacks // Tap callbacks
// static void tapReset(void *tapinfo_ptr); static void tapReset(void *tapinfo_ptr);
static tap_packet_status tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *data); static tap_packet_status tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *data);
static void tapDraw(void *tapinfo_ptr); static void tapDraw(void *tapinfo_ptr);

View File

@ -286,7 +286,10 @@ voip_calls_reset_all_taps(voip_calls_tapinfo_t *tapinfo)
g_queue_clear(tapinfo->callsinfos); g_queue_clear(tapinfo->callsinfos);
/* free the SIP_HASH */ /* free the SIP_HASH */
if(NULL!=tapinfo->callsinfo_hashtable[SIP_HASH]) if(NULL!=tapinfo->callsinfo_hashtable[SIP_HASH])
{
g_hash_table_remove_all (tapinfo->callsinfo_hashtable[SIP_HASH]); g_hash_table_remove_all (tapinfo->callsinfo_hashtable[SIP_HASH]);
tapinfo->callsinfo_hashtable[SIP_HASH] = NULL;
}
/* free the strinfo data items first */ /* free the strinfo data items first */
list = g_list_first(tapinfo->rtpstream_list); list = g_list_first(tapinfo->rtpstream_list);