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
This commit is contained in:
Matthias Radestock committed 2014-09-23 11:06:41 +01:00
1 parent 7815446032
commit b5df59660f
1 file changed
-3
-3
View File
@@ -40,9 +40,6 @@ func newPcapIO(ifName string, promisc bool, snaplen int, bufSz int) (handle *Pca
if err = inactive.SetSnapLen(snaplen); err != nil {
return
}
if err = inactive.SetTimeout(-1); err != nil {
return
}
if err = inactive.SetImmediateMode(true); err != nil {
return
}