Close stopChan on exit

This commit is contained in:
Toby 2021-04-21 21:42:35 -07:00
parent bca98ef4da
commit 98ddad22f6

View file

@ -64,6 +64,7 @@ func (r *UDPRelay) ListenAndServe() error {
var connMapMutex sync.RWMutex
// Timeout cleanup routine
stopChan := make(chan bool)
defer close(stopChan)
go func() {
ticker := time.NewTicker(udpMinTimeout)
defer ticker.Stop()