From 83b64eb86e12af013b01f894da0b871d1a0808f4 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Sat, 7 May 2022 12:44:28 +0800 Subject: [PATCH] chore: modify sniff error log --- component/sniffer/dispatcher.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/component/sniffer/dispatcher.go b/component/sniffer/dispatcher.go index 41df40ac..63f3abd2 100644 --- a/component/sniffer/dispatcher.go +++ b/component/sniffer/dispatcher.go @@ -2,7 +2,9 @@ package sniffer import ( "errors" + "fmt" "github.com/Dreamacro/clash/constant/sniffer" + "io" "net" "net/netip" "strconv" @@ -100,12 +102,12 @@ func (sd *SnifferDispatcher) sniffDomain(conn *CN.BufferedConn, metadata *C.Meta _ = conn.SetReadDeadline(time.Time{}) if err != nil { _, ok := err.(*net.OpError) - if ok { - log.Errorln("[Sniffer] [%s] Maybe read timeout, Consider adding skip", metadata.DstIP.String()) + if io.EOF == err || ok { + log.Errorln("[Sniffer] [%s] may not have any sent data, Consider adding skip", metadata.DstIP.String()) _ = conn.Close() } - log.Errorln("[Sniffer] %v", err) - return "", err + + return "", fmt.Errorf("[Sniffer] sniff occur error: %v", err) } bufferedLen := conn.Buffered()