Pārlūkot izejas kodu

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

Simon Frei 5 gadi atpakaļ
vecāks
revīzija
ce4d149bf5
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  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()