From c9e6b5854197dd33d4e20ed78aee8382472a0f01 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 11 Jan 2015 13:54:04 +0200 Subject: enable tcpNoDelay for loopback connections automatically it can make a significant speed difference for applications talking to the office binary via UNO Change-Id: If6e901908fe6a6119ac1fd0bf8feebabe5602ff7 Reviewed-on: https://gerrit.libreoffice.org/13856 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- io/source/acceptor/acc_socket.cxx | 6 +++++- io/source/connector/connector.cxx | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'io') diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx index 830a9b36375d..89fb44dde0f4 100644 --- a/io/source/acceptor/acc_socket.cxx +++ b/io/source/acceptor/acc_socket.cxx @@ -380,7 +380,11 @@ namespace io_acceptor { } pConn->completeConnectionString(); - if( m_bTcpNoDelay ) + OUString remoteHostname = pConn->m_addr.getHostname(); + // we enable tcpNoDelay for loopback connections because + // it can make a significant speed difference on linux boxes. + if( m_bTcpNoDelay || remoteHostname == "localhost" || + remoteHostname.startsWith("127.0.0.") ) { sal_Int32 nTcpNoDelay = sal_True; pConn->m_socket.setOption( osl_Socket_OptionTcpNoDelay , &nTcpNoDelay, diff --git a/io/source/connector/connector.cxx b/io/source/connector/connector.cxx index 0aca22cc1685..81bfdb64ddb2 100644 --- a/io/source/connector/connector.cxx +++ b/io/source/connector/connector.cxx @@ -132,7 +132,9 @@ namespace stoc_connector delete pConn; throw NoConnectException( sMessage ); } - if( bTcpNoDelay ) + // we enable tcpNoDelay for loopback connections because + // it can make a significant speed difference on linux boxes. + if( bTcpNoDelay || aHost == "localhost" || aHost.startsWith("127.0.0.") ) { sal_Int32 nTcpNoDelay = sal_True; pConn->m_socket.setOption( osl_Socket_OptionTcpNoDelay , &nTcpNoDelay, -- cgit v1.2.3