From 5db4493557cd45fa799d951f53183e3a3a9d6aba Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 14 Dec 2022 15:37:18 +0000 Subject: [PATCH] lib/http: fix race condition --- lib/http/context.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/http/context.go b/lib/http/context.go index 34bff8fa6..239572c75 100644 --- a/lib/http/context.go +++ b/lib/http/context.go @@ -19,12 +19,9 @@ const ( func NewBaseContext(ctx context.Context, url string) func(l net.Listener) context.Context { return func(l net.Listener) context.Context { if l.Addr().Network() == "unix" { - ctx = context.WithValue(ctx, ctxKeyUnixSock, true) - return ctx + return context.WithValue(ctx, ctxKeyUnixSock, true) } - - ctx = context.WithValue(ctx, ctxKeyPublicURL, url) - return ctx + return context.WithValue(ctx, ctxKeyPublicURL, url) } }