Clean up indentation a bit.
authorGuy Harris <guy@alum.mit.edu>
Sat, 29 Sep 2007 02:05:09 +0000 (02:05 -0000)
committerGuy Harris <guy@alum.mit.edu>
Sat, 29 Sep 2007 02:05:09 +0000 (02:05 -0000)
Count packets even if we're not dissecting them.

svn path=/trunk/; revision=23026

tshark.c

index ecea587a3fc2187aab626bbe12d1bf9cd290b83a..98fc2b7ba55e6adfc6c24ed713b1dae11b54474b 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -1966,22 +1966,28 @@ capture_input_new_packets(capture_options *capture_opts, int to_read)
 #endif /* SIGINFO */
 
   if(do_dissection) {
-         while (to_read-- && cf->wth) {
-                 ret = wtap_read(cf->wth, &err, &err_info, &data_offset);
-                 if(ret == FALSE) {
-                         /* read from file failed, tell the capture child to stop */
-                         sync_pipe_stop(capture_opts);
-                         wtap_close(cf->wth);
-                         cf->wth = NULL;
-                 } else {
-                         ret = process_packet(cf, data_offset, wtap_phdr(cf->wth),
-                                                          wtap_pseudoheader(cf->wth), wtap_buf_ptr(cf->wth));
-                 }
-                 if (ret != FALSE) {
-                       /* packet sucessfully read and gone through the "Read Filter" */
-                       packet_count++;
-                 }
-         }
+    while (to_read-- && cf->wth) {
+      ret = wtap_read(cf->wth, &err, &err_info, &data_offset);
+      if(ret == FALSE) {
+        /* read from file failed, tell the capture child to stop */
+        sync_pipe_stop(capture_opts);
+        wtap_close(cf->wth);
+        cf->wth = NULL;
+      } else {
+        ret = process_packet(cf, data_offset, wtap_phdr(cf->wth),
+                             wtap_pseudoheader(cf->wth), wtap_buf_ptr(cf->wth));
+      }
+      if (ret != FALSE) {
+        /* packet sucessfully read and gone through the "Read Filter" */
+        packet_count++;
+      }
+    }
+  } else {
+    /*
+     * Dumpcap's doing all the work; we're not doing any dissection.
+     * Count all the packets it wrote.
+     */
+    packet_count += to_read;
   }
 
   if (print_packet_counts) {