diff --git a/tap/tcp_reader.go b/tap/tcp_reader.go index 687e9c317..1cc7be82f 100644 --- a/tap/tcp_reader.go +++ b/tap/tcp_reader.go @@ -91,7 +91,7 @@ func (h *tcpReader) Read(p []byte) (int, error) { return l, nil } -func (h *tcpReader) run(wg *sync.WaitGroup) { +func (h *tcpReader) run(wg *sync.WaitGroup, isClient bool) { defer wg.Done() data, err := io.ReadAll(h) @@ -102,9 +102,7 @@ func (h *tcpReader) run(wg *sync.WaitGroup) { r := bytes.NewReader(data) for _, extension := range extensions { - for _, isClient := range []bool{true, false} { - r.Reset(data) - extension.Dissector.Dissect(bufio.NewReader(r), isClient, h.tcpID, h.Emitter) - } + r.Reset(data) + extension.Dissector.Dissect(bufio.NewReader(r), isClient, h.tcpID, h.Emitter) } } diff --git a/tap/tcp_stream_factory.go b/tap/tcp_stream_factory.go index 1e0ef4946..9fe849482 100644 --- a/tap/tcp_stream_factory.go +++ b/tap/tcp_stream_factory.go @@ -82,8 +82,8 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T } factory.wg.Add(2) // Start reading from channel stream.reader.bytes - go stream.client.run(&factory.wg) - go stream.server.run(&factory.wg) + go stream.client.run(&factory.wg, true) + go stream.server.run(&factory.wg, false) } return stream }