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:
1 parent
7815446032
commit
b5df59660f
1 file changed
-3
@@ -40,9 +40,6 @@ func newPcapIO(ifName string, promisc bool, snaplen int, bufSz int) (handle *Pca
|
|||||||
if err = inactive.SetSnapLen(snaplen); err != nil {
|
if err = inactive.SetSnapLen(snaplen); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err = inactive.SetTimeout(-1); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err = inactive.SetImmediateMode(true); err != nil {
|
if err = inactive.SetImmediateMode(true); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user