mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-17 17:48:40 +00:00
Add err check
This commit is contained in:
parent
f3e1c28a20
commit
b5715246c1
1 changed files with 5 additions and 4 deletions
|
@ -373,7 +373,10 @@ func sniffer(ctx context.Context, cReader *cachedReader, metadataOnly bool, netw
|
||||||
return nil, ctx.Err()
|
return nil, ctx.Err()
|
||||||
default:
|
default:
|
||||||
cachingStartingTimeStamp := time.Now()
|
cachingStartingTimeStamp := time.Now()
|
||||||
cacheErr := cReader.Cache(payload, cacheDeadline)
|
err := cReader.Cache(payload, cacheDeadline)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
cachingTimeElapsed := time.Since(cachingStartingTimeStamp)
|
cachingTimeElapsed := time.Since(cachingStartingTimeStamp)
|
||||||
cacheDeadline -= cachingTimeElapsed
|
cacheDeadline -= cachingTimeElapsed
|
||||||
|
|
||||||
|
@ -383,9 +386,7 @@ func sniffer(ctx context.Context, cReader *cachedReader, metadataOnly bool, netw
|
||||||
case common.ErrNoClue: // No Clue: protocol not matches, and sniffer cannot determine whether there will be a match or not
|
case common.ErrNoClue: // No Clue: protocol not matches, and sniffer cannot determine whether there will be a match or not
|
||||||
totalAttempt++
|
totalAttempt++
|
||||||
case protocol.ErrProtoNeedMoreData: // Protocol Need More Data: protocol matches, but need more data to complete sniffing
|
case protocol.ErrProtoNeedMoreData: // Protocol Need More Data: protocol matches, but need more data to complete sniffing
|
||||||
if cacheErr != nil { // Cache error (e.g. timeout) counts for failed attempt
|
// in this case, do not add totalAttempt(allow to read until timeout)
|
||||||
totalAttempt++
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue