Skip to content

Commit

Permalink
update: 暂不关闭hopCh管道,原因待查
Browse files Browse the repository at this point in the history
  • Loading branch information
sjlleo committed May 18, 2022
1 parent 14730bb commit 6b08727
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions trace/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,15 @@ func (t *TCPTracer) send(ttl int) error {
hopCh := make(chan Hop)
t.inflightRequest[int(sequenceNumber)] = hopCh
t.inflightRequestLock.Unlock()
defer func() {
t.inflightRequestLock.Lock()
close(hopCh)
delete(t.inflightRequest, srcPort)
t.inflightRequestLock.Unlock()
}()
/*
// 关了会有问题,偶见 panic: send on closed channel 报错
defer func() {
t.inflightRequestLock.Lock()
close(hopCh)
delete(t.inflightRequest, srcPort)
t.inflightRequestLock.Unlock()
}()
*/
select {
case <-t.ctx.Done():
return nil
Expand Down

0 comments on commit 6b08727

Please sign in to comment.