From b5df59660fe83fd5a5d4d3ddd23e6b084ef56465 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 23 Sep 2014 11:06:41 +0100 Subject: [PATCH] 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 --- pcap.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pcap.go b/pcap.go index 354ec818..912d0fba 100644 --- a/pcap.go +++ b/pcap.go @@ -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 }