TUN-8855: fix lint issues

## Summary

Fix lint issues necessary for a subsequent PR. This is only separate to allow a better code review of the actual changes.

Closes TUN-8855
This commit is contained in:
Luis Neto
2025-01-30 03:53:24 -08:00
committed by João "Pisco" Fernandes
parent 45f67c23fd
commit bfdb0c76dc
8 changed files with 53 additions and 62 deletions

View File

@@ -103,9 +103,15 @@ func (q *quicConnection) Serve(ctx context.Context) error {
// amount of the grace period, allowing requests to finish before we cancel the context, which will
// make cloudflared exit.
if err := q.serveControlStream(ctx, controlStream); err == nil {
select {
case <-ctx.Done():
case <-time.Tick(q.gracePeriod):
if q.gracePeriod > 0 {
// In Go1.23 this can be removed and replaced with time.Ticker
// see https://pkg.go.dev/time#Tick
ticker := time.NewTicker(q.gracePeriod)
defer ticker.Stop()
select {
case <-ctx.Done():
case <-ticker.C:
}
}
}
cancel()