diff --git a/tap/tcp_reader.go b/tap/tcp_reader.go index e15ae87db..23528ff59 100644 --- a/tap/tcp_reader.go +++ b/tap/tcp_reader.go @@ -82,10 +82,14 @@ func (reader *tcpReader) isProtocolIdentified() bool { } func (reader *tcpReader) rewind() { - // Reset the data and msgBuffer from the master record + // Reset the data reader.data = make([]byte, 0) + + // Reset msgBuffer from the master record + reader.parent.Lock() reader.msgBuffer = make([]api.TcpReaderDataMsg, len(reader.msgBufferMaster)) copy(reader.msgBuffer, reader.msgBufferMaster) + reader.parent.Unlock() // Reset the read progress reader.progress.Reset() diff --git a/tap/tcp_stream.go b/tap/tcp_stream.go index ca99da6c6..31664ac3e 100644 --- a/tap/tcp_stream.go +++ b/tap/tcp_stream.go @@ -72,8 +72,10 @@ func (t *tcpStream) SetProtocol(protocol *api.Protocol) { t.protocol = protocol // Clean the buffers + t.Lock() t.client.msgBufferMaster = make([]api.TcpReaderDataMsg, 0) t.server.msgBufferMaster = make([]api.TcpReaderDataMsg, 0) + t.Unlock() } func (t *tcpStream) GetOrigin() api.Capture {