mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
wgengine/bench: ignore "engine closing" errors
On benchmark completion, we shut down the wgengine. If we happen to poll for status during shutdown, we get an "engine closing" error. It doesn't hurt anything; ignore it. Fixes tailscale/corp#1776 Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
d707e2f7e5
commit
68911f6778
@ -5,6 +5,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
@ -89,6 +90,9 @@ func setupWGTest(b *testing.B, logf logger.Logf, traf *TrafficGen, a1, a2 netadd
|
||||
|
||||
var e1waitDoneOnce sync.Once
|
||||
e1.SetStatusCallback(func(st *wgengine.Status, err error) {
|
||||
if errors.Is(err, wgengine.ErrEngineClosing) {
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatalf("e1 status err: %v", err)
|
||||
}
|
||||
@ -124,6 +128,9 @@ func setupWGTest(b *testing.B, logf logger.Logf, traf *TrafficGen, a1, a2 netadd
|
||||
|
||||
var e2waitDoneOnce sync.Once
|
||||
e2.SetStatusCallback(func(st *wgengine.Status, err error) {
|
||||
if errors.Is(err, wgengine.ErrEngineClosing) {
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatalf("e2 status err: %v", err)
|
||||
}
|
||||
|
@ -880,6 +880,8 @@ func (e *userspaceEngine) getStatusCallback() StatusCallback {
|
||||
|
||||
var singleNewline = []byte{'\n'}
|
||||
|
||||
var ErrEngineClosing = errors.New("engine closing; no status")
|
||||
|
||||
func (e *userspaceEngine) getStatus() (*Status, error) {
|
||||
// Grab derpConns before acquiring wgLock to not violate lock ordering;
|
||||
// the DERPs method acquires magicsock.Conn.mu.
|
||||
@ -893,7 +895,7 @@ func (e *userspaceEngine) getStatus() (*Status, error) {
|
||||
closing := e.closing
|
||||
e.mu.Unlock()
|
||||
if closing {
|
||||
return nil, errors.New("engine closing; no status")
|
||||
return nil, ErrEngineClosing
|
||||
}
|
||||
|
||||
if e.wgdev == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user