Turns out one OS thread isn't enough

This commit is contained in:
Matthias Radestock committed 2014-08-31 14:43:06 +01:00
1 parent 2649796369
commit 971f6a63fd
1 file changed
+7 -1
+7 -1
View File
@@ -46,7 +46,13 @@ func main() {
log.SetPrefix(weave.Protocol + " ")
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds)
runtime.GOMAXPROCS(runtime.NumCPU())
procs := runtime.NumCPU()
// packet sniffing can block an OS thread, so we need one thread
// for that plus at least one more.
if procs < 2 {
procs = 2
}
runtime.GOMAXPROCS(procs)
var (
ifaceName string