Removed implementation of the --disable-select-loop config option.

Preprocessor conditional blocks resulting from an existing definition of
USE_SELECT_LOOP are now always taken.
This commit is contained in:
Jon Siwek 2010-10-19 10:05:54 -05:00
parent 79754bf6f8
commit efc8b24576
3 changed files with 0 additions and 20 deletions

View file

@ -201,9 +201,6 @@
/* Use Google's perftools */ /* Use Google's perftools */
#undef USE_PERFTOOLS #undef USE_PERFTOOLS
/* Use select-based main loop */
#cmakedefine USE_SELECT_LOOP
/* Version number of package */ /* Version number of package */
#define VERSION "@VERSION@" #define VERSION "@VERSION@"

View file

@ -29,10 +29,8 @@ FlowSrc::~FlowSrc()
void FlowSrc::GetFds(int* read, int* write, int* except) void FlowSrc::GetFds(int* read, int* write, int* except)
{ {
#ifdef USE_SELECT_LOOP
if ( selectable_fd >= 0 ) if ( selectable_fd >= 0 )
*read = selectable_fd; *read = selectable_fd;
#endif
} }
double FlowSrc::NextTimestamp(double* network_time) double FlowSrc::NextTimestamp(double* network_time)

View file

@ -65,10 +65,8 @@ void PktSrc::GetFds(int* read, int* write, int* except)
return; return;
} }
#ifdef USE_SELECT_LOOP
if ( selectable_fd >= 0 ) if ( selectable_fd >= 0 )
*read = selectable_fd; *read = selectable_fd;
#endif
} }
int PktSrc::ExtractNextPacket() int PktSrc::ExtractNextPacket()
@ -90,11 +88,7 @@ int PktSrc::ExtractNextPacket()
if ( ! first_timestamp ) if ( ! first_timestamp )
first_timestamp = next_timestamp; first_timestamp = next_timestamp;
#ifdef USE_SELECT_LOOP
idle = (data == 0); idle = (data == 0);
#else
idle = false;
#endif
if ( data ) if ( data )
++stats.received; ++stats.received;
@ -370,16 +364,12 @@ PktInterfaceSrc::PktInterfaceSrc(const char* arg_interface, const char* filter,
netmask = 0xffffff00; netmask = 0xffffff00;
} }
#ifdef USE_SELECT_LOOP
// We use the smallest time-out possible to return almost immediately if // We use the smallest time-out possible to return almost immediately if
// no packets are available. (We can't use set_nonblocking() as it's // no packets are available. (We can't use set_nonblocking() as it's
// broken on FreeBSD: even when select() indicates that we can read // broken on FreeBSD: even when select() indicates that we can read
// something, we may get nothing if the store buffer hasn't filled up // something, we may get nothing if the store buffer hasn't filled up
// yet.) // yet.)
pd = pcap_open_live(interface, snaplen, 1, 1, tmp_errbuf); pd = pcap_open_live(interface, snaplen, 1, 1, tmp_errbuf);
#else
pd = pcap_open_live(interface, snaplen, 1, PCAP_TIMEOUT, tmp_errbuf);
#endif
if ( ! pd ) if ( ! pd )
{ {
@ -394,8 +384,6 @@ PktInterfaceSrc::PktInterfaceSrc(const char* arg_interface, const char* filter,
fprintf(stderr, "pcap bufsize = %d\n", ((struct pcap *) pd)->bufsize); fprintf(stderr, "pcap bufsize = %d\n", ((struct pcap *) pd)->bufsize);
#endif #endif
#ifdef USE_SELECT_LOOP
#ifdef HAVE_LINUX #ifdef HAVE_LINUX
if ( pcap_setnonblock(pd, 1, tmp_errbuf) < 0 ) if ( pcap_setnonblock(pd, 1, tmp_errbuf) < 0 )
{ {
@ -407,7 +395,6 @@ PktInterfaceSrc::PktInterfaceSrc(const char* arg_interface, const char* filter,
} }
#endif #endif
selectable_fd = pcap_fileno(pd); selectable_fd = pcap_fileno(pd);
#endif
if ( PrecompileFilter(0, filter) && SetFilter(0) ) if ( PrecompileFilter(0, filter) && SetFilter(0) )
{ {
@ -437,7 +424,6 @@ PktFileSrc::PktFileSrc(const char* arg_readfile, const char* filter,
// Unknown link layer type. // Unknown link layer type.
return; return;
#ifdef USE_SELECT_LOOP
// We don't put file sources into non-blocking mode as // We don't put file sources into non-blocking mode as
// otherwise we would not be able to identify the EOF // otherwise we would not be able to identify the EOF
// via next_packet(). // via next_packet().
@ -446,7 +432,6 @@ PktFileSrc::PktFileSrc(const char* arg_readfile, const char* filter,
if ( selectable_fd < 0 ) if ( selectable_fd < 0 )
internal_error("OS does not support selectable pcap fd"); internal_error("OS does not support selectable pcap fd");
#endif
} }
else else
closed = true; closed = true;