fix potential panic on http server close (#496)

This commit is contained in:
Brian Goff
2019-01-15 10:37:06 -08:00
committed by GitHub
parent e98d3ad2ae
commit 20911aa3b5
2 changed files with 25 additions and 20 deletions

View File

@@ -108,13 +108,11 @@ This allows users to schedule kubernetes workloads on nodes that aren't running
rootContextCancel()
}()
c1, c2, err := setupHTTPServer(rootContext, apiConfig)
cancelHTTP, err := setupHTTPServer(rootContext, apiConfig)
if err != nil {
log.G(rootContext).Fatal(err)
}
defer c1.Close()
defer c2.Close()
defer cancelHTTP()
if err := vk.Run(rootContext); err != nil && errors.Cause(err) != context.Canceled {
log.G(rootContext).Fatal(err)