Make CloseOtherProtocolDissectors method mutexed

This commit is contained in:
M. Mert Yildiran
2022-04-21 11:38:49 +03:00
parent 1cce863bbb
commit 838318733a

View File

@@ -157,17 +157,15 @@ func (t *TcpStream) ReassemblyComplete(ac reassembly.AssemblerContext) bool {
}
func (t *TcpStream) Close() {
shouldReturn := false
t.Lock()
defer t.Unlock()
if t.isClosed {
shouldReturn = true
} else {
t.isClosed = true
}
t.Unlock()
if shouldReturn {
return
}
t.isClosed = true
t.StreamsMap.Delete(t.Id)
for i := range t.Clients {
@@ -181,6 +179,9 @@ func (t *TcpStream) Close() {
}
func (t *TcpStream) CloseOtherProtocolDissectors(protocol *Protocol) {
t.Lock()
defer t.Unlock()
if t.ProtoIdentifier.IsClosedOthers {
return
}