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

This commit is contained in:
Simon Frei 2020-08-19 16:58:44 +02:00 committed by GitHub
parent cbbc262161
commit ce4d149bf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()