Update to latest Csocket

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1814 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-03-07 15:46:36 +00:00
parent ec08e22ed7
commit 467a5a570e
2 changed files with 32 additions and 15 deletions
+15 -11
View File
@@ -28,7 +28,7 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* $Revision: 1.131 $
* $Revision: 1.134 $
*/
#include "Csocket.h"
@@ -721,7 +721,7 @@ void Csock::Copy( const Csock & cCopy )
#endif /* HAVE_LIBSSL */
if( m_vcCrons.size() )
if( !m_vcCrons.empty() )
{
for( u_long a = 0; a < m_vcCrons.size(); a++ )
{
@@ -966,11 +966,15 @@ bool Csock::Listen( u_short iPort, int iMaxConns, const CS_STRING & sBindHost, u
return( false );
#ifdef HAVE_IPV6
#ifdef IPV6_V6ONLY
// per RFC3493#5.3
const int on = ( m_address.GetAFRequire() == CSSockAddr::RAF_INET6 ? 1 : 0 );
if( setsockopt( m_iReadSock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&on, sizeof( on ) ) != 0 )
PERROR( "IPV6_V6ONLY" );
// there's no IPPROTO_IPV6 below Win XP. - KiNgMaR
#if (!defined(_WIN32) && defined(IPV6_V6ONLY)) || (defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0501)
if( GetIPv6() )
{
// per RFC3493#5.3
const int on = ( m_address.GetAFRequire() == CSSockAddr::RAF_INET6 ? 1 : 0 );
if( setsockopt( m_iReadSock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&on, sizeof( on ) ) != 0 )
PERROR( "IPV6_V6ONLY" );
}
#endif /* IPV6_V6ONLY */
#endif /* HAVE_IPV6 */
@@ -1475,9 +1479,9 @@ bool Csock::Write( const char *data, size_t len )
}
#endif /* HAVE_LIBSSL */
#ifdef _WIN32
ssize_t bytes = send( m_iWriteSock, m_sSend.data(), iBytesToSend, 0 );
cs_ssize_t bytes = send( m_iWriteSock, m_sSend.data(), iBytesToSend, 0 );
#else
ssize_t bytes = write( m_iWriteSock, m_sSend.data(), iBytesToSend );
cs_ssize_t bytes = write( m_iWriteSock, m_sSend.data(), iBytesToSend );
#endif /* _WIN32 */
if ( ( bytes == -1 ) && ( GetSockError() == ECONNREFUSED ) )
@@ -1511,9 +1515,9 @@ bool Csock::Write( const CS_STRING & sData )
return( Write( sData.c_str(), sData.length() ) );
}
ssize_t Csock::Read( char *data, size_t len )
cs_ssize_t Csock::Read( char *data, size_t len )
{
ssize_t bytes = 0;
cs_ssize_t bytes = 0;
if ( ( IsReadPaused() ) && ( SslIsEstablished() ) )
return( READ_EAGAIN ); // allow the handshake to complete first