chore: sniffer give the err to the caller

This commit is contained in:
Skyxim 2022-05-08 09:09:39 +08:00
parent ca9c859059
commit aded1b78b5

View file

@ -2,9 +2,7 @@ package sniffer
import ( import (
"errors" "errors"
"fmt"
"github.com/Dreamacro/clash/constant/sniffer" "github.com/Dreamacro/clash/constant/sniffer"
"io"
"net" "net"
"net/netip" "net/netip"
"strconv" "strconv"
@ -102,12 +100,12 @@ func (sd *SnifferDispatcher) sniffDomain(conn *CN.BufferedConn, metadata *C.Meta
_ = conn.SetReadDeadline(time.Time{}) _ = conn.SetReadDeadline(time.Time{})
if err != nil { if err != nil {
_, ok := err.(*net.OpError) _, ok := err.(*net.OpError)
if io.EOF == err || ok { if ok {
log.Errorln("[Sniffer] [%s] may not have any sent data, Consider adding skip", metadata.DstIP.String()) log.Errorln("[Sniffer] [%s] may not have any sent data, Consider adding skip", metadata.DstIP.String())
_ = conn.Close() _ = conn.Close()
} }
return "", fmt.Errorf("[Sniffer] sniff occur error: %v", err) return "", err
} }
bufferedLen := conn.Buffered() bufferedLen := conn.Buffered()