aboutsummaryrefslogtreecommitdiffstats
path: root/capture.c
diff options
context:
space:
mode:
authordeniel <deniel@f5534014-38df-0310-8fa8-9805f1628bb7>1999-07-28 20:17:24 +0000
committerdeniel <deniel@f5534014-38df-0310-8fa8-9805f1628bb7>1999-07-28 20:17:24 +0000
commite2f4ce46296f83d8db0953e8005bacb09f7094e7 (patch)
tree040abfbb6ce1a094da6ad72c0b6e9a163167a6df /capture.c
parent070b238eaa6fd87ada0a2acc6d1ffd645c3efe6b (diff)
Fix the -S option :
- read only the real number of packets that have been written by the child process. That's avoid incomplete packet read. - special timeout handling no more necessary and the whole real time capture and display behavior is much more satisfying with this patch. - wiretap modified to allow the reading of 'count' packets with wtap_loop. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@398 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'capture.c')
-rw-r--r--capture.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/capture.c b/capture.c
index 4e8f8b652a..776907108a 100644
--- a/capture.c
+++ b/capture.c
@@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
- * $Id: capture.c,v 1.36 1999/07/28 02:40:16 gerald Exp $
+ * $Id: capture.c,v 1.37 1999/07/28 20:17:14 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -413,6 +413,7 @@ capture(void) {
ld.max = cf.count;
ld.linktype = DLT_NULL;
ld.sync_time = 0;
+ ld.sync_packets = 0;
ld.counts.tcp = 0;
ld.counts.udp = 0;
ld.counts.ospf = 0;
@@ -614,14 +615,21 @@ capture_pcap_cb(u_char *user, const struct pcap_pkthdr *phdr,
if (ld->pdh) pcap_dump((u_char *) ld->pdh, phdr, pd);
cur_time = time(NULL);
+
+ ld->sync_packets ++;
+
if (cur_time > *sync_time) {
/* sync every second */
*sync_time = cur_time;
fflush((FILE *)ld->pdh);
- if (sync_mode)
- write(1, "D", 1);
+ if (sync_mode && ld->sync_packets) {
+ char tmp[20];
+ sprintf(tmp, "%d*", ld->sync_packets);
+ write(1, tmp, strlen(tmp));
+ ld->sync_packets = 0;
+ }
}
-
+
switch (ld->linktype) {
case DLT_EN10MB :
capture_eth(pd, phdr->caplen, &ld->counts);