From 88b5ed974ebc604150a5d918237656ad0735d767 Mon Sep 17 00:00:00 2001 From: Jörg Budischewski Date: Wed, 11 Apr 2001 14:44:09 +0000 Subject: #85985# tcpnodelay socket option is now interpreted --- io/source/acceptor/acc_socket.cxx | 19 +++++++++++++------ io/source/acceptor/acceptor.cxx | 14 ++++++++++---- io/source/acceptor/acceptor.hxx | 6 ++++-- io/source/connector/connector.cxx | 22 ++++++++++++++++------ 4 files changed, 43 insertions(+), 18 deletions(-) diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx index d8b964396975..6c3570e2fda8 100644 --- a/io/source/acceptor/acc_socket.cxx +++ b/io/source/acceptor/acc_socket.cxx @@ -2,9 +2,9 @@ * * $RCSfile: acc_socket.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: jbu $ $Date: 2001-03-15 11:10:54 $ + * last change: $Author: jbu $ $Date: 2001-04-11 15:43:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -349,13 +349,15 @@ namespace io_acceptor { _listeners.erase(aListener); } - SocketAcceptor::SocketAcceptor( const OUString &sSocketName , - sal_uInt16 nPort , + SocketAcceptor::SocketAcceptor( const OUString &sSocketName, + sal_uInt16 nPort, + sal_Bool bTcpNoDelay, const OUString &sConnectionDescription) : m_bClosed( sal_False ), m_sSocketName( sSocketName ), m_nPort( nPort ), - m_sConnectionDescription( sConnectionDescription ) + m_sConnectionDescription( sConnectionDescription ), + m_bTcpNoDelay( bTcpNoDelay ) { } @@ -398,7 +400,12 @@ namespace io_acceptor { } pConn->completeConnectionString(); - pConn->m_socket.setOption( osl_Socket_OptionTcpNoDelay, 1 ); + if( m_bTcpNoDelay ) + { + sal_Int32 nTcpNoDelay = sal_True; + pConn->m_socket.setOption( osl_Socket_OptionTcpNoDelay , &nTcpNoDelay, + sizeof( nTcpNoDelay ) , osl_Socket_LevelTcp ); + } return Reference < XConnection > ( (XConnection * ) pConn ); } diff --git a/io/source/acceptor/acceptor.cxx b/io/source/acceptor/acceptor.cxx index b89b22709ad0..6b1d6840b2ae 100644 --- a/io/source/acceptor/acceptor.cxx +++ b/io/source/acceptor/acceptor.cxx @@ -2,9 +2,9 @@ * * $RCSfile: acceptor.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: jl $ $Date: 2001-03-12 15:50:58 $ + * last change: $Author: jbu $ $Date: 2001-04-11 15:43:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -293,7 +293,8 @@ namespace io_acceptor else if ( 0 == container.getToken(0).compareToAscii("socket") ) { OUString sHost = OUString( RTL_CONSTASCII_USTRINGPARAM("localhost")); - sal_uInt16 nPort; + sal_uInt16 nPort = 0; + sal_Bool bTcpNoDelay = sal_False; sal_Int32 i; for( i = 1 ;i < container.getTokenCount() ; i ++ ) @@ -313,11 +314,16 @@ namespace io_acceptor { nPort = (sal_uInt16) oValue.toInt32(); } + else if( aName.compareToAscii("tcpnodelay") == 0 ) + { + bTcpNoDelay = oValue.toInt32() ? sal_True : sal_False; + } } } } - m_pSocket = new SocketAcceptor( sHost , nPort, sConnectionDescription ); + m_pSocket = new SocketAcceptor( + sHost , nPort, bTcpNoDelay, sConnectionDescription ); try { diff --git a/io/source/acceptor/acceptor.hxx b/io/source/acceptor/acceptor.hxx index 2373e732e5ee..8514756042d5 100644 --- a/io/source/acceptor/acceptor.hxx +++ b/io/source/acceptor/acceptor.hxx @@ -2,9 +2,9 @@ * * $RCSfile: acceptor.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jbu $ $Date: 2001-03-15 11:10:54 $ + * last change: $Author: jbu $ $Date: 2001-04-11 15:43:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,6 +92,7 @@ namespace io_acceptor { public: SocketAcceptor( const ::rtl::OUString & sSocketName , sal_uInt16 nPort, + sal_Bool bTcpNoDelay, const ::rtl::OUString &sConnectionDescription ); void init(); @@ -104,6 +105,7 @@ namespace io_acceptor { ::rtl::OUString m_sSocketName; ::rtl::OUString m_sConnectionDescription; sal_uInt16 m_nPort; + sal_Bool m_bTcpNoDelay; sal_Bool m_bClosed; }; diff --git a/io/source/connector/connector.cxx b/io/source/connector/connector.cxx index d11684023932..e021c50fc19f 100644 --- a/io/source/connector/connector.cxx +++ b/io/source/connector/connector.cxx @@ -2,9 +2,9 @@ * * $RCSfile: connector.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: jbu $ $Date: 2001-03-15 11:09:54 $ + * last change: $Author: jbu $ $Date: 2001-04-11 15:44:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -232,7 +232,8 @@ namespace stoc_connector else if( 0 == container.getToken(0).compareToAscii("socket") ) { OUString sHost; - sal_uInt16 nPort; + sal_uInt16 nPort = 0; + sal_Bool bTcpNoDelay = sal_False; int i; for( i = 1 ; i < container.getTokenCount() ; i ++ ) @@ -252,15 +253,18 @@ namespace stoc_connector { nPort = ( sal_uInt16 ) oValue.toInt32(); } + else if( aName.compareToAscii("tcpnodelay") == 0 ) + { + bTcpNoDelay = oValue.toInt32() ? sal_True : sal_False; + } } } } - SocketConnection *pConn = new SocketConnection( sHost , - nPort , + SocketConnection *pConn = new SocketConnection( sHost, + nPort, sConnectionDescription); - pConn->m_socket.setOption( osl_Socket_OptionTcpNoDelay , sal_True ); SocketAddr AddrTarget( sHost.pData, nPort ); if(pConn->m_socket.connect(AddrTarget) != osl_Socket_Ok) { @@ -271,6 +275,12 @@ namespace stoc_connector delete pConn; throw NoConnectException( sMessage, Reference < XInterface > () ); } + if( bTcpNoDelay ) + { + sal_Int32 nTcpNoDelay = sal_True; + pConn->m_socket.setOption( osl_Socket_OptionTcpNoDelay , &nTcpNoDelay, + sizeof( nTcpNoDelay ) , osl_Socket_LevelTcp ); + } pConn->completeConnectionString(); r = Reference< XConnection > ( (XConnection * ) pConn ); } -- cgit v1.2.3