Fix failing unit test due to the connection not being a tcp connection in tests.

This commit is contained in:
notsure2 2023-06-11 01:40:03 +03:00
parent e2e8a8e9be
commit 391c017956
1 changed files with 14 additions and 12 deletions

View File

@ -32,20 +32,22 @@ func MakeSession(connConfig RemoteConnConfig, authInfo AuthInfo, dialer common.D
goto makeconn
}
tcpConn := remoteConn.(*net.TCPConn)
syscallConn, err := tcpConn.SyscallConn()
if err != nil {
panic(err)
}
err = syscallConn.Control(func(fd uintptr) {
err = syscall.SetsockoptInt(common.Platformfd(fd), syscall.IPPROTO_TCP, syscall.TCP_NODELAY, 1)
tcpConn, ok := remoteConn.(*net.TCPConn)
if ok {
syscallConn, err := tcpConn.SyscallConn()
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()