mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 14:26:31 +00:00
fix: producing timeout error in case with no timeout errors (#180)
Co-authored-by: Anton Piunov <anton.piunov@cyberprotect.ru>
This commit is contained in:
parent
87161e0538
commit
d97d4e483c
@ -22,8 +22,9 @@ func ReadBytes(conn *net.TCPConn, dest []byte) ([]byte, error) {
|
||||
func readBytesInternal(conn *net.TCPConn, dest []byte) (int, error) {
|
||||
totalRead, err := conn.Read(dest)
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
case *net.OpError:
|
||||
var opError *net.OpError
|
||||
switch {
|
||||
case errors.As(err, &opError) && opError.Timeout():
|
||||
return totalRead, errors.New("timed out")
|
||||
default:
|
||||
return totalRead, err
|
||||
|
Loading…
Reference in New Issue
Block a user