mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 22:36:53 +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) {
|
func readBytesInternal(conn *net.TCPConn, dest []byte) (int, error) {
|
||||||
totalRead, err := conn.Read(dest)
|
totalRead, err := conn.Read(dest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err.(type) {
|
var opError *net.OpError
|
||||||
case *net.OpError:
|
switch {
|
||||||
|
case errors.As(err, &opError) && opError.Timeout():
|
||||||
return totalRead, errors.New("timed out")
|
return totalRead, errors.New("timed out")
|
||||||
default:
|
default:
|
||||||
return totalRead, err
|
return totalRead, err
|
||||||
|
Loading…
Reference in New Issue
Block a user