|
|
@ -93,7 +93,9 @@ func (s *serveListener) Run() {
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
ln, err := net.Listen("tcp", s.ap.String())
|
|
|
|
ln, err := net.Listen("tcp", s.ap.String())
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
if s.shouldWarnAboutListenError(err) {
|
|
|
|
s.logf("serve failed to listen on %v, backing off: %v", s.ap, err)
|
|
|
|
s.logf("serve failed to listen on %v, backing off: %v", s.ap, err)
|
|
|
|
|
|
|
|
}
|
|
|
|
s.bo.BackOff(s.ctx, err)
|
|
|
|
s.bo.BackOff(s.ctx, err)
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -111,6 +113,17 @@ func (s *serveListener) Run() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (s *serveListener) shouldWarnAboutListenError(err error) bool {
|
|
|
|
|
|
|
|
if !s.b.e.GetLinkMonitor().InterfaceState().HasIP(s.ap.Addr()) {
|
|
|
|
|
|
|
|
// Machine likely doesn't have IPv6 enabled (or the IP is still being
|
|
|
|
|
|
|
|
// assigned). No need to warn. Notably, WSL2 (Issue 6303).
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(bradfitz): check errors.Is(err, syscall.EADDRNOTAVAIL) etc? Let's
|
|
|
|
|
|
|
|
// see what happens in practice.
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// handleServeListenersAccept accepts connections for the Listener.
|
|
|
|
// handleServeListenersAccept accepts connections for the Listener.
|
|
|
|
// Calls incoming handler in a new goroutine for each accepted connection.
|
|
|
|
// Calls incoming handler in a new goroutine for each accepted connection.
|
|
|
|
func (s *serveListener) handleServeListenersAccept(ln net.Listener) error {
|
|
|
|
func (s *serveListener) handleServeListenersAccept(ln net.Listener) error {
|
|
|
|