Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed May 18, 2024
1 parent 94d8ccd commit f58f76c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packets.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ func (mc *mysqlConn) writePacket(data []byte) error {
}
return err
}
if n != size+4 {
if n != 4+size {
// io.Writer(b) must return a non-nil error if it cannot write len(b) bytes.
// The io.ErrShortWrite error is used to indicate that this rule has not been followed.
mc.cleanup()
return io.ErrShortWrite
}
Expand All @@ -142,7 +144,6 @@ func (mc *mysqlConn) writePacket(data []byte) error {
}
pktLen -= size
data = data[size:]
continue
}
}

Expand Down

0 comments on commit f58f76c

Please sign in to comment.