修复设置抓包率引起的查询时间异常的问题

This commit is contained in:
hebo
2019-11-14 21:52:19 +08:00
parent 16722c878c
commit 85bef28022
2 changed files with 20 additions and 18 deletions

View File

@@ -87,7 +87,7 @@ func (ms *MysqlSession) ReceiveTCPPacket(newPkt *model.TCPPacket) {
ms.readFromClient(newPkt.Seq, newPkt.Payload)
} else {
ms.readFromServer(newPkt.Payload)
ms.readFromServer(newPkt.Seq, newPkt.Payload)
qp := ms.GenerateQueryPiece()
if qp != nil {
ms.queryPieceReceiver <- qp
@@ -99,7 +99,7 @@ func (ms *MysqlSession) resetBeginTime() {
ms.stmtBeginTime = time.Now().UnixNano() / millSecondUnit
}
func (ms *MysqlSession) readFromServer(bytes []byte) {
func (ms *MysqlSession) readFromServer(respSeq int64, bytes []byte) {
if ms.expectSendSize < 1 && len(bytes) > 4 {
ms.expectSendSize = extractMysqlPayloadSize(bytes[:4])
contents := bytes[4:]
@@ -107,6 +107,10 @@ func (ms *MysqlSession) readFromServer(bytes []byte) {
ms.prepareInfo.prepareStmtID = bytesToInt(contents[1:5])
}
}
if ms.coverRanges.head.next == nil || ms.coverRanges.head.next.end != respSeq {
ms.clear()
}
}
func (ms *MysqlSession) checkFinish() bool {