Skip to content

Commit f3fc80a

Browse files
committed
fix: add read deadline to udp read.
1 parent 76a9314 commit f3fc80a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

wire/vpn_response.go

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package wire
33
import (
44
"fmt"
55
"net"
6+
"time"
67

78
"tunelo/transport"
89
)
@@ -11,6 +12,9 @@ func (w *Wire) readVPNResponse(vpnConn net.Conn, transportConn *transport.Conn)
1112
buf := make([]byte, w.BufSize)
1213

1314
for {
15+
readDeadline := time.Now().Add(10 * time.Second)
16+
vpnConn.SetReadDeadline(readDeadline)
17+
1418
n, err := vpnConn.Read(buf)
1519
if err != nil {
1620
w.Logger.Error(fmt.Errorf("reading from vpn conn: %v", err), nil)

0 commit comments

Comments
 (0)