code: func (m *mux) loop() {
  	var err error
  	for err == nil {
  		err = m.onePacket()
  	}
  
  	for _, ch := range m.chanList.dropAll() {
  		ch.close()
  	}
  
  	close(m.incomingChannels)
  	close(m.incomingRequests)
  	close(m.globalResponses)
  
  	m.conn.Close()
  
  	m.errCond.L.Lock()
  	m.err = err
  	m.errCond.Broadcast()
  	m.errCond.L.Unlock()
  
  	if debugMux {
  		log.Println("loop exit", err)
  	}
  }
docs: // loop runs the connection machine. It will process packets until an
  // error is encountered. To synchronize on loop exit, use mux.Wait.