Browse Source

set conn deadline

pull/15/head
Jason 5 years ago
parent
commit
07a658ae0e
  1. 4
      proxy/socks/tcp.go

4
proxy/socks/tcp.go

@ -54,6 +54,8 @@ func (h *tcpHandler) relay(localConn, remoteConn net.Conn) {
if _, err := io.Copy(remoteConn, localConn); err != nil {
closeOnce()
} else {
localConn.SetDeadline(time.Now())
remoteConn.SetDeadline(time.Now())
tcpCloseRead(localConn)
tcpCloseWrite(remoteConn)
}
@ -64,6 +66,8 @@ func (h *tcpHandler) relay(localConn, remoteConn net.Conn) {
if _, err := io.Copy(localConn, remoteConn); err != nil {
closeOnce()
} else {
localConn.SetDeadline(time.Now())
remoteConn.SetDeadline(time.Now())
tcpCloseRead(remoteConn)
tcpCloseWrite(localConn)
}

Loading…
Cancel
Save