code: func (s *Server) Loop() {
  	type sbuf struct {
  		buf []byte
  		len int
  	}
  	pool := make(chan *sbuf, 2)
  	pool <- &sbuf{buf: make([]byte, s.rxMTU)}
  	pool <- &sbuf{buf: make([]byte, s.rxMTU)}
  
  	seq := make(chan *sbuf)
  	go func() {
  		b := <-pool
  		for {
  			n, err := s.conn.Read(b.buf)
  			if n == 0 || err != nil {
  				close(seq)
  				close(s.chConfirm)
  				_ = s.conn.Close()
  				return
  			}
  			if b.buf[0] == HandleValueConfirmationCode {
  				select {
  				case s.chConfirm <- true:
  				default:
  					logger.Error("server", "recieved a spurious confirmation", nil)
  				}
  				continue
  			}
  			b.len = n
  			seq <- b   // Send the current request for handling
  			b = <-pool // Swap the buffer for next incoming request.
  		}
  	}()
  	for req := range seq {
  		if rsp := s.handleRequest(req.buf[:req.len]); rsp != nil {
  			if len(rsp) != 0 {
  				s.conn.Write(rsp)
  			}
  		}
  		pool <- req
  	}
  	for h, ccc := range s.conn.cccs {
  		if ccc != 0 {
  			logger.Info("cleanup", "ccc", fmt.Sprintf("0x%02X", ccc))
  		}
  		if ccc&cccIndicate != 0 {
  			s.conn.in[h].Close()
  		}
  		if ccc&cccNotify != 0 {
  			s.conn.nn[h].Close()
  		}
  	}
  }
docs: // Loop accepts incoming ATT request, and respond response.