Ethereal-dev: Re: [Ethereal-dev] [PATCH] Flush tethereal capture file if FIFO

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Sun, 23 Jun 2002 13:37:33 -0700
On Sun, Jun 23, 2002 at 08:37:42PM +0100, Graeme Hewson wrote:
> The patch to tethereal.c flushes the buffer after every frame if the
> capture file is a FIFO.  Together with the patch to ringbuffer.c, error
> handling is also improved.

Checked in.

It might be worth having "capture()", in Tethereal, if no capture file
size stop condition is in effect, pass to "pcap_dispatch()" as the
packet count argument a value of:

	-1 if "packet_count" is 0;

	"packet_count" if "packet_count" is non-zero;

and move the flushing of the output stream into "capture()" out of
"wtap_dispatch_cb_write()", so that if multiple packets were read in
from the capture device, the buffer is flushed only after all of them
have been written.

If a read filter is in effect, that won't work right with the "-c" flag,
but, as the "packet_count" code currently counts packets delivered by
"pcap_dispatch()", it already doesn't work correctly.

BTW, several people have reported that if you try to ^C out of Tethereal
on Windows, it (Tethereal) crashes; I think the problem is that the
"longjmp()" fails - I don't know why that happens.