PIPE_READ_TIMEOUT should be in microseconds, not milliseconds.

As it's a constant, we can do the split into seconds and microseconds at
compile time, so do that (so that it works even if we happen to make
PIPE_READ_TIMEOUT >= 1 second).

svn path=/trunk/; revision=34283
This commit is contained in:
Guy Harris 2010-09-30 01:40:03 +00:00
parent 7fab58179a
commit 5770f7fe86
1 changed files with 7 additions and 6 deletions

View File

@ -295,14 +295,15 @@ static gboolean need_timeout_workaround;
/*
* Timeout, in microseconds, for reads from the stream of captured packets
* from a pipe. Pipes doesn't have the same problem that BPF devices do
* from a pipe. Pipes don't have the same problem that BPF devices do
* in OS X 10.6, 10.6.1, 10.6.3, and 10.6.4, so we always use a timeout
* of 250ms.
* of 250ms, i.e. the same value as CAP_READ_TIMEOUT when not on one
* of the offending versions of Snow Leopard.
*
* XXX - why was it 100 for threaded capturing?
* XXX - why is it 100 for threaded capturing?
*/
#ifndef USE_THREADS
#define PIPE_READ_TIMEOUT 250
#define PIPE_READ_TIMEOUT 250000
#else
#define PIPE_READ_TIMEOUT 100
#endif
@ -1587,8 +1588,8 @@ cap_pipe_select(int pipe_fd) {
FD_ZERO(&rfds);
FD_SET(pipe_fd, &rfds);
timeout.tv_sec = 0;
timeout.tv_usec = PIPE_READ_TIMEOUT * 1000;
timeout.tv_sec = PIPE_READ_TIMEOUT / 1000000;
timeout.tv_usec = PIPE_READ_TIMEOUT % 1000000;
sel_ret = select(pipe_fd+1, &rfds, NULL, NULL, &timeout);
if (sel_ret < 0)