Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It seems that the compression doesn't take effect #1

Open
zhanghaiyang9999 opened this issue Nov 16, 2021 · 0 comments
Open

It seems that the compression doesn't take effect #1

zhanghaiyang9999 opened this issue Nov 16, 2021 · 0 comments

Comments

@zhanghaiyang9999
Copy link

the function

func (pc *packetCompressor) writePacket(mc *mysqlConn, packet []byte) (int, error) {
if len(packet) == 0 {
return 0, nil
}

var index = 0

for index < len(packet) {
	var err error
	var remain = len(packet) - index
	var bytesWritten int

	**bytesWritten, err = pc.writeToBuffer(packet[index:], mc.compressionSequence, remain < minCompressSize)**
	if err != nil {
		return index, err
	}

Please see the BOLD line

and the function writeToBuffer

func (pc *packetCompressor) writeToBuffer(data []byte, sequence uint8, compress bool) (int, error) {

the 3rd parameter is compress bool, it means always is false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant