mirror of https://github.com/cbeuw/Cloak
Fix failing unit test due to the connection not being a tcp connection in tests.
This commit is contained in:
parent
e2e8a8e9be
commit
391c017956
|
|
@ -32,20 +32,22 @@ func MakeSession(connConfig RemoteConnConfig, authInfo AuthInfo, dialer common.D
|
||||||
goto makeconn
|
goto makeconn
|
||||||
}
|
}
|
||||||
|
|
||||||
tcpConn := remoteConn.(*net.TCPConn)
|
tcpConn, ok := remoteConn.(*net.TCPConn)
|
||||||
syscallConn, err := tcpConn.SyscallConn()
|
if ok {
|
||||||
if err != nil {
|
syscallConn, err := tcpConn.SyscallConn()
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = syscallConn.Control(func(fd uintptr) {
|
|
||||||
err = syscall.SetsockoptInt(common.Platformfd(fd), syscall.IPPROTO_TCP, syscall.TCP_NODELAY, 1)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("setsocketopt TCP_NODELAY: %s\n", err)
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = syscallConn.Control(func(fd uintptr) {
|
||||||
|
err = syscall.SetsockoptInt(common.Platformfd(fd), syscall.IPPROTO_TCP, syscall.TCP_NODELAY, 1)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("setsocketopt TCP_NODELAY: %s\n", err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
}
|
}
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
transportConn := connConfig.TransportMaker()
|
transportConn := connConfig.TransportMaker()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue