diff options
Diffstat (limited to 'ui/gtk/capture_file_dlg.c')
-rw-r--r-- | ui/gtk/capture_file_dlg.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c index baef2baed9..74f35d6748 100644 --- a/ui/gtk/capture_file_dlg.c +++ b/ui/gtk/capture_file_dlg.c @@ -173,6 +173,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name) static void preview_do(GtkWidget *prev, wtap *wth) { + int rec_type; GtkWidget *label; unsigned int elapsed_time; time_t time_preview; @@ -183,6 +184,7 @@ preview_do(GtkWidget *prev, wtap *wth) double start_time = 0; /* seconds, with nsec resolution */ double stop_time = 0; /* seconds, with nsec resolution */ double cur_time; + unsigned int records = 0; unsigned int packets = 0; gboolean is_breaked = FALSE; gchar string_buff[PREVIEW_STR_MAX]; @@ -192,22 +194,25 @@ preview_do(GtkWidget *prev, wtap *wth) time(&time_preview); - while ( (wtap_read(wth, &err, &err_info, &data_offset)) ) { - phdr = wtap_phdr(wth); - cur_time = nstime_to_sec(&phdr->ts); - if (packets == 0) { - start_time = cur_time; - stop_time = cur_time; - } - if (cur_time < start_time) { - start_time = cur_time; - } - if (cur_time > stop_time) { - stop_time = cur_time; - } + while ( (rec_type = wtap_read(wth, &err, &err_info, &data_offset)) != -1 ) { + if (rec_type == REC_TYPE_PACKET) { + phdr = wtap_phdr(wth); + cur_time = nstime_to_sec(&phdr->ts); + if (packets == 0) { + start_time = cur_time; + stop_time = cur_time; + } + if (cur_time < start_time) { + start_time = cur_time; + } + if (cur_time > stop_time) { + stop_time = cur_time; + } - packets++; - if (packets%1000 == 0) { + packets++; + } + records++; + if (records%1000 == 0) { /* do we have a timeout? */ time(&time_current); if (time_current-time_preview >= (time_t) prefs.gui_fileopen_preview) { |