mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2025-08-12 06:26:39 +00:00
Merge pull request #60 from FyZhu97/bugfix/inflightRequest-deadlock
[bugfix] fix inflightRequestLock deadlock in tcp/udp tracing
This commit is contained in:
@@ -264,7 +264,7 @@ func (t *TCPTracer) send(ttl int) error {
|
||||
return err
|
||||
}
|
||||
t.inflightRequestLock.Lock()
|
||||
hopCh := make(chan Hop)
|
||||
hopCh := make(chan Hop, 1)
|
||||
t.inflightRequest[int(sequenceNumber)] = hopCh
|
||||
t.inflightRequestLock.Unlock()
|
||||
/*
|
||||
|
||||
@@ -251,7 +251,7 @@ func (t *TCPTracerv6) send(ttl int) error {
|
||||
}
|
||||
// log.Println(ttl, sequenceNumber)
|
||||
t.inflightRequestLock.Lock()
|
||||
hopCh := make(chan Hop)
|
||||
hopCh := make(chan Hop, 1)
|
||||
t.inflightRequest[int(sequenceNumber)] = hopCh
|
||||
t.inflightRequestLock.Unlock()
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ func (t *UDPTracer) send(ttl int) error {
|
||||
|
||||
// 在对inflightRequest进行写操作的时候应该加锁保护,以免多个goroutine协程试图同时写入造成panic
|
||||
t.inflightRequestLock.Lock()
|
||||
hopCh := make(chan Hop)
|
||||
hopCh := make(chan Hop, 1)
|
||||
t.inflightRequest[srcPort] = hopCh
|
||||
t.inflightRequestLock.Unlock()
|
||||
defer func() {
|
||||
|
||||
Reference in New Issue
Block a user