code: func (s *Session) recvLoop() error {
  	defer close(s.recvDoneCh)
  	hdr := header(make([]byte, headerSize))
  	for {
  		// Read the header
  		if _, err := io.ReadFull(s.bufRead, hdr); err != nil {
  			if err != io.EOF && !strings.Contains(err.Error(), "closed") && !strings.Contains(err.Error(), "reset by peer") {
  				s.logger.Printf("[ERR] yamux: Failed to read header: %v", err)
  			}
  			return err
  		}
  
  		// Verify the version
  		if hdr.Version() != protoVersion {
  			s.logger.Printf("[ERR] yamux: Invalid protocol version: %d", hdr.Version())
  			return ErrInvalidVersion
  		}
  
  		mt := hdr.MsgType()
  		if mt < typeData || mt > typeGoAway {
  			return ErrInvalidMsgType
  		}
  
  		if err := handlers[mt](s, hdr); err != nil {
  			return err
  		}
  	}
  }
docs: // recvLoop continues to receive data until a fatal error is encountered