From 6b08727993d03980c8c70d70090f2d4d55146e9f Mon Sep 17 00:00:00 2001 From: sjlleo Date: Wed, 18 May 2022 21:19:19 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9A=82=E4=B8=8D=E5=85=B3=E9=97=ADh?= =?UTF-8?q?opCh=E7=AE=A1=E9=81=93=EF=BC=8C=E5=8E=9F=E5=9B=A0=E5=BE=85?= =?UTF-8?q?=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trace/tcp.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/trace/tcp.go b/trace/tcp.go index 71c83e34..33614025 100644 --- a/trace/tcp.go +++ b/trace/tcp.go @@ -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