mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 22:36:53 +00:00
add timeout
This commit is contained in:
parent
ce40143581
commit
b7a76ab5ec
@ -2,6 +2,7 @@ package net
|
||||
|
||||
import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/xvzc/SpoofDPI/doh"
|
||||
@ -56,6 +57,8 @@ func (conn *Conn) ReadBytes() ([]byte, error) {
|
||||
ret := make([]byte, 0)
|
||||
buf := make([]byte, BUF_SIZE)
|
||||
|
||||
conn.conn.SetReadDeadline(time.Now().Add(3 * time.Second))
|
||||
|
||||
for {
|
||||
n, err := conn.Read(buf)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user