mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-08 10:10:12 +08:00
optimize socks tcp.go
This commit is contained in:
@@ -56,8 +56,7 @@ func (h *tcpHandler) relay(localConn, remoteConn net.Conn) {
|
|||||||
} else {
|
} else {
|
||||||
localConn.SetDeadline(time.Now())
|
localConn.SetDeadline(time.Now())
|
||||||
remoteConn.SetDeadline(time.Now())
|
remoteConn.SetDeadline(time.Now())
|
||||||
tcpCloseRead(localConn)
|
tcpCloseRead(remoteConn)
|
||||||
tcpCloseWrite(remoteConn)
|
|
||||||
}
|
}
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
@@ -68,8 +67,7 @@ func (h *tcpHandler) relay(localConn, remoteConn net.Conn) {
|
|||||||
} else {
|
} else {
|
||||||
localConn.SetDeadline(time.Now())
|
localConn.SetDeadline(time.Now())
|
||||||
remoteConn.SetDeadline(time.Now())
|
remoteConn.SetDeadline(time.Now())
|
||||||
tcpCloseRead(remoteConn)
|
tcpCloseRead(localConn)
|
||||||
tcpCloseWrite(localConn)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait() // Wait for Up Link done
|
wg.Wait() // Wait for Up Link done
|
||||||
|
Reference in New Issue
Block a user