code: func (srv *Server) listenLoop() {
  	defer srv.loopWG.Done()
  	srv.log.Debug("TCP listener up", "addr", srv.listener.Addr())
  
  	tokens := defaultMaxPendingPeers
  	if srv.MaxPendingPeers > 0 {
  		tokens = srv.MaxPendingPeers
  	}
  	slots := make(chan struct{}, tokens)
  	for i := 0; i < tokens; i++ {
  		slots <- struct{}{}
  	}
  
  	for {
  		// Wait for a handshake slot before accepting.
  		<-slots
  
  		var (
  			fd  net.Conn
  			err error
  		)
  		for {
  			fd, err = srv.listener.Accept()
  			if netutil.IsTemporaryError(err) {
  				srv.log.Debug("Temporary read error", "err", err)
  				continue
  			} else if err != nil {
  				srv.log.Debug("Read error", "err", err)
  				return
  			}
  			break
  		}
  
  		// Reject connections that do not match NetRestrict.
  		if srv.NetRestrict != nil {
  			if tcp, ok := fd.RemoteAddr().(*net.TCPAddr); ok && !srv.NetRestrict.Contains(tcp.IP) {
  				srv.log.Debug("Rejected conn (not whitelisted in NetRestrict)", "addr", fd.RemoteAddr())
  				fd.Close()
  				slots <- struct{}{}
  				continue
  			}
  		}
  
  		var ip net.IP
  		if tcp, ok := fd.RemoteAddr().(*net.TCPAddr); ok {
  			ip = tcp.IP
  		}
  		fd = newMeteredConn(fd, true, ip)
  		srv.log.Trace("Accepted connection", "addr", fd.RemoteAddr())
  		go func() {
  			srv.SetupConn(fd, inboundConn, nil)
  			slots <- struct{}{}
  		}()
  	}
  }
docs: // listenLoop runs in its own goroutine and accepts
  // inbound connections.