Archived
1 parent
1cb55904bc
commit
4d3432af3e
8 files changed
+174
-150
No files matched your search
+6
-2
@@ -109,8 +109,8 @@ func New(cfg config.Wrapper, subscriber Subscriber, conn net.PacketConn) (*Servi
|
||||
}
|
||||
|
||||
func (s *Service) Stop() {
|
||||
s.Service.Stop()
|
||||
_ = s.stunConn.Close()
|
||||
s.Service.Stop()
|
||||
}
|
||||
|
||||
func (s *Service) serve(stop chan struct{}) {
|
||||
@@ -163,7 +163,11 @@ func (s *Service) serve(stop chan struct{}) {
|
||||
|
||||
// We failed to contact all provided stun servers or the nat is not punchable.
|
||||
// Chillout for a while.
|
||||
time.Sleep(stunRetryInterval)
|
||||
select {
|
||||
case <-time.After(stunRetryInterval):
|
||||
case <-stop:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user