From 9b11ea527aeb6b08a47c2edeb782a5b08c76a414 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sun, 20 Sep 2020 15:48:07 +0300 Subject: [PATCH] add Wait option Signed-off-by: Vasiliy Tolstov --- server/options.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/options.go b/server/options.go index b57d32ef..83fc3ed9 100644 --- a/server/options.go +++ b/server/options.go @@ -46,6 +46,7 @@ type Options struct { // TLSConfig specifies tls.Config for secure serving TLSConfig *tls.Config + Wait *sync.WaitGroup // Other options for implementations of the interface // can be stored in a context Context context.Context @@ -234,13 +235,10 @@ func WithRouter(r Router) Option { // wait against it on stop. func Wait(wg *sync.WaitGroup) Option { return func(o *Options) { - if o.Context == nil { - o.Context = context.Background() - } if wg == nil { wg = new(sync.WaitGroup) } - o.Context = context.WithValue(o.Context, "wait", wg) + o.Wait = wg } }