Commit Graph
7 Commits
Author SHA1 Message Date
Bryan Boreham d80a5c8dff Revert "don't set pcap timeout, to prevent cpu churn"
This reverts commit b5df59660f.
See issue #81
2014-09-23 16:56:08 +01:00
Matthias Radestock b5df59660f don't set pcap timeout, to prevent cpu churn
pcap timeouts are a mystery. Setting the timeout to -1 used to reduce
latency, but that was before we started setting immediate mode. And it
turns out that with that timeout, pcap chews through a lot of CPU
polling its file descriptor, checking timers, etc.

With no timeout set an idle weave is completely idle - no system calls
at all.

Fixes #80
2014-09-23 11:06:41 +01:00
David Wragg 12b969004e Filter outbound packets in the kernel
It turns out that under Linux, libpcap implements the SetDirection
filtering in userspace, causing some spurious wake ups of the packet
capture thread.  So set a BPF filter to discard outbound packets inside
the kernel.
2014-09-17 23:42:48 +01:00
Matthias Radestock 7b85049e0b fix error handling in pcap creation 2014-08-20 17:28:14 +01:00
Matthias Radestock 1a41df1edf zero copy capture
delay copying until necessary
2014-08-20 16:08:43 +01:00
Matthias Radestock 7c4464c852 pcap handles are not thread safe
they contain an errbuf; there might be other issues too.
So we must use different handles in the sniffer and udplistener
goroutines.
2014-08-20 11:42:55 +01:00
Matthias Radestock cb2cdc90cc introduce abstraction for packet i/o 2014-08-20 11:18:12 +01:00