Skip to content

Commit 750fe2a

Browse files
committed
fix typo
1 parent 0e3ace3 commit 750fe2a

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

compress.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ func (c *compressor) uncompressPacket() error {
128128
fmt.Fprintf(os.Stderr, "uncompress cmplen=%v uncomplen=%v seq=%v\n",
129129
comprLength, uncompressedLength, compressionSequence)
130130
}
131-
if compressionSequence != c.mc.compresSequence {
131+
if compressionSequence != c.mc.compressSequence {
132132
return ErrPktSync
133133
}
134-
c.mc.compresSequence++
134+
c.mc.compressSequence++
135135

136136
comprData, err := c.mc.buf.readNext(comprLength)
137137
if err != nil {
@@ -214,15 +214,15 @@ func (c *compressor) writeCompressedPacket(data []byte, uncompressedLen int) err
214214
c.mc.cfg.Logger.Print(
215215
fmt.Sprintf(
216216
"writeCompressedPacket: comprLength=%v, uncompressedLen=%v, seq=%v",
217-
comprLength, uncompressedLen, c.mc.compresSequence))
217+
comprLength, uncompressedLen, c.mc.compressSequence))
218218
}
219219

220220
// compression header
221221
data[0] = byte(0xff & comprLength)
222222
data[1] = byte(0xff & (comprLength >> 8))
223223
data[2] = byte(0xff & (comprLength >> 16))
224224

225-
data[3] = c.mc.compresSequence
225+
data[3] = c.mc.compressSequence
226226

227227
// this value is never greater than maxPayloadLength
228228
data[4] = byte(0xff & uncompressedLen)
@@ -234,6 +234,6 @@ func (c *compressor) writeCompressedPacket(data []byte, uncompressedLen int) err
234234
return err
235235
}
236236

237-
c.mc.compresSequence++
237+
c.mc.compressSequence++
238238
return nil
239239
}

compress_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func newMockBuf(data []byte) buffer {
3838
func compressHelper(t *testing.T, mc *mysqlConn, uncompressedPacket []byte) []byte {
3939
// get status variables
4040

41-
cs := mc.compresSequence
41+
cs := mc.compressSequence
4242

4343
var b bytes.Buffer
4444
cw := newCompressor(mc, &b)
@@ -54,13 +54,13 @@ func compressHelper(t *testing.T, mc *mysqlConn, uncompressedPacket []byte) []by
5454
}
5555

5656
if len(uncompressedPacket) > 0 {
57-
if mc.compresSequence != (cs + 1) {
58-
t.Fatalf("mc.compressionSequence updated incorrectly, expected %d and saw %d", (cs + 1), mc.compresSequence)
57+
if mc.compressSequence != (cs + 1) {
58+
t.Fatalf("mc.compressionSequence updated incorrectly, expected %d and saw %d", (cs + 1), mc.compressSequence)
5959
}
6060

6161
} else {
62-
if mc.compresSequence != cs {
63-
t.Fatalf("mc.compressionSequence updated incorrectly for case of empty write, expected %d and saw %d", cs, mc.compresSequence)
62+
if mc.compressSequence != cs {
63+
t.Fatalf("mc.compressionSequence updated incorrectly for case of empty write, expected %d and saw %d", cs, mc.compressSequence)
6464
}
6565
}
6666

@@ -70,7 +70,7 @@ func compressHelper(t *testing.T, mc *mysqlConn, uncompressedPacket []byte) []by
7070
// uncompressHelper uncompresses compressedPacket and checks state variables
7171
func uncompressHelper(t *testing.T, mc *mysqlConn, compressedPacket []byte, expSize int) []byte {
7272
// get status variables
73-
cs := mc.compresSequence
73+
cs := mc.compressSequence
7474

7575
// mocking out buf variable
7676
mc.buf = newMockBuf(compressedPacket)
@@ -84,12 +84,12 @@ func uncompressHelper(t *testing.T, mc *mysqlConn, compressedPacket []byte, expS
8484
}
8585

8686
if expSize > 0 {
87-
if mc.compresSequence != (cs + 1) {
88-
t.Fatalf("mc.compressionSequence updated incorrectly, expected %d and saw %d", (cs + 1), mc.compresSequence)
87+
if mc.compressSequence != (cs + 1) {
88+
t.Fatalf("mc.compressionSequence updated incorrectly, expected %d and saw %d", (cs + 1), mc.compressSequence)
8989
}
9090
} else {
91-
if mc.compresSequence != cs {
92-
t.Fatalf("mc.compressionSequence updated incorrectly for case of empty read, expected %d and saw %d", cs, mc.compresSequence)
91+
if mc.compressSequence != cs {
92+
t.Fatalf("mc.compressionSequence updated incorrectly for case of empty read, expected %d and saw %d", cs, mc.compressSequence)
9393
}
9494
}
9595
return uncompressedPacket

connection.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type mysqlConn struct {
3535
flags clientFlag
3636
status statusFlag
3737
sequence uint8
38-
compresSequence uint8
38+
compressSequence uint8
3939
parseTime bool
4040
compress bool
4141

@@ -54,7 +54,7 @@ type packetReader interface {
5454

5555
func (mc *mysqlConn) resetSequenceNr() {
5656
mc.sequence = 0
57-
mc.compresSequence = 0
57+
mc.compressSequence = 0
5858
}
5959

6060
// syncSequenceNr must be called when finished writing some packet and before start reading.
@@ -64,7 +64,7 @@ func (mc *mysqlConn) syncSequenceNr() {
6464
// https://github.com/mariadb-corporation/mariadb-connector-c/blob/8228164f850b12353da24df1b93a1e53cc5e85e9/libmariadb/ma_net.c#L170-L171
6565
// https://github.com/mysql/mysql-server/blob/824e2b4064053f7daf17d7f3f84b7a3ed92e5fb4/sql-common/net_serv.cc#L293
6666
if mc.compress {
67-
mc.sequence = mc.compresSequence
67+
mc.sequence = mc.compressSequence
6868
}
6969
}
7070

0 commit comments

Comments
 (0)