Browse Source

lib/nat: Don't hang on draining timer chan (fixes #6908) (#6912)

Simon Frei 5 years ago
parent
commit
ce4d149bf5
1 changed files with 4 additions and 1 deletions
  1. 4 1
      lib/nat/service.go

+ 4 - 1
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()