mirror of https://github.com/cbeuw/Cloak
Fix: buffer should be set even in unordered mode because in the end it's tcp
This commit is contained in:
parent
18355d06ce
commit
c3cde8d8af
|
|
@ -155,30 +155,28 @@ func main() {
|
||||||
var seshMaker func() *mux.Session
|
var seshMaker func() *mux.Session
|
||||||
|
|
||||||
control := func(network string, address string, rawConn syscall.RawConn) error {
|
control := func(network string, address string, rawConn syscall.RawConn) error {
|
||||||
if !authInfo.Unordered {
|
sendBufferSize := remoteConfig.TcpSendBuffer
|
||||||
sendBufferSize := remoteConfig.TcpSendBuffer
|
receiveBufferSize := remoteConfig.TcpReceiveBuffer
|
||||||
receiveBufferSize := remoteConfig.TcpReceiveBuffer
|
|
||||||
|
|
||||||
err := rawConn.Control(func(fd uintptr) {
|
err := rawConn.Control(func(fd uintptr) {
|
||||||
if sendBufferSize > 0 {
|
if sendBufferSize > 0 {
|
||||||
log.Debugf("Setting remote connection tcp send buffer: %d", sendBufferSize)
|
log.Debugf("Setting remote connection tcp send buffer: %d", sendBufferSize)
|
||||||
err := syscall.SetsockoptInt(common.Platformfd(fd), syscall.SOL_SOCKET, syscall.SO_SNDBUF, sendBufferSize)
|
err := syscall.SetsockoptInt(common.Platformfd(fd), syscall.SOL_SOCKET, syscall.SO_SNDBUF, sendBufferSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("setsocketopt SO_SNDBUF: %s\n", err)
|
log.Errorf("setsocketopt SO_SNDBUF: %s\n", err)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if receiveBufferSize > 0 {
|
|
||||||
log.Debugf("Setting remote connection tcp receive buffer: %d", receiveBufferSize)
|
|
||||||
err = syscall.SetsockoptInt(common.Platformfd(fd), syscall.SOL_SOCKET, syscall.SO_RCVBUF, receiveBufferSize)
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("setsocketopt SO_RCVBUF: %s\n", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if receiveBufferSize > 0 {
|
||||||
|
log.Debugf("Setting remote connection tcp receive buffer: %d", receiveBufferSize)
|
||||||
|
err = syscall.SetsockoptInt(common.Platformfd(fd), syscall.SOL_SOCKET, syscall.SO_RCVBUF, receiveBufferSize)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("setsocketopt SO_RCVBUF: %s\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return protector(network, address, rawConn)
|
return protector(network, address, rawConn)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue