From ce4d149bf5a9afc791e50f0b88ca21b786b04c64 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Wed, 19 Aug 2020 16:58:44 +0200 Subject: [PATCH] lib/nat: Don't hang on draining timer chan (fixes #6908) (#6912) --- lib/nat/service.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/nat/service.go b/lib/nat/service.go index ef5f00a06..901ceac6d 100644 --- a/lib/nat/service.go +++ b/lib/nat/service.go @@ -85,7 +85,10 @@ func (s *Service) serve(ctx context.Context) { case <-timer.C: case <-s.processScheduled: if !timer.Stop() { - <-timer.C + select { + case <-timer.C: + default: + } } case <-ctx.Done(): timer.Stop()