deal multi packages

This commit is contained in:
hebo
2019-08-16 23:02:08 +08:00
parent 30c0b35811
commit 16a5d8db26
6 changed files with 158 additions and 27 deletions

View File

@@ -3,6 +3,7 @@ package mysql
import (
"bytes"
"encoding/binary"
"fmt"
)
// parseHandshakeResponseHeader parses the common header of SSLRequest and HandshakeResponse41.
@@ -121,8 +122,10 @@ func parseLengthEncodedInt(b []byte) (num uint64, isNull bool, n int) {
return
}
func extractMysqlPayloadSize(payload []byte) int {
header := payload[:4]
func extractMysqlPayloadSize(header []byte) int {
fmt.Printf("==== package header: %v\n", header)
// return int(uint32(header[0]) | uint32(header[1])<<8 | uint32(header[2])<<16)
return int(uint32(header[0]) | uint32(header[1])<<8 | uint32(header[2])<<16)
}