From 04d54e8d8287152a8c0d6a3aec7e53cd4aa65aab Mon Sep 17 00:00:00 2001 From: James Shubin Date: Wed, 22 Nov 2023 22:11:50 -0500 Subject: [PATCH] engine: resources: Mask normal closing error This could possibly be fixed upstream, but we'll workaround it for now. --- engine/resources/dhcp.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/resources/dhcp.go b/engine/resources/dhcp.go index 0ec84f11..6a55cd3e 100644 --- a/engine/resources/dhcp.go +++ b/engine/resources/dhcp.go @@ -19,6 +19,7 @@ package resources import ( "context" + "errors" "fmt" "net" "net/url" @@ -449,7 +450,10 @@ func (obj *DHCPServerRes) Watch(ctx context.Context) error { defer close(closeSignal) err := server.Serve() // blocks until Close() is called I hope! - if err == nil { + // TODO: getting this error is probably a bug, please see: + // https://github.com/insomniacslk/dhcp/issues/376 + isClosing := errors.Is(err, net.ErrClosed) + if err == nil || isClosing { return } // if this returned on its own, then closeSignal can be used...