Network/AbstractSocket: Prevent querying/setting receive/send buffer size without opening the socket first
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2017 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Network module"
|
// This file is part of the "Nazara Engine - Network module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|||||||
@@ -117,8 +117,7 @@ namespace Nz
|
|||||||
*/
|
*/
|
||||||
std::size_t AbstractSocket::QueryReceiveBufferSize() const
|
std::size_t AbstractSocket::QueryReceiveBufferSize() const
|
||||||
{
|
{
|
||||||
if (m_handle == SocketImpl::InvalidHandle)
|
NazaraAssert(m_handle != SocketImpl::InvalidHandle, "Socket must be created first");
|
||||||
return 0;
|
|
||||||
|
|
||||||
return SocketImpl::QueryReceiveBufferSize(m_handle);
|
return SocketImpl::QueryReceiveBufferSize(m_handle);
|
||||||
}
|
}
|
||||||
@@ -129,8 +128,7 @@ namespace Nz
|
|||||||
*/
|
*/
|
||||||
std::size_t AbstractSocket::QuerySendBufferSize() const
|
std::size_t AbstractSocket::QuerySendBufferSize() const
|
||||||
{
|
{
|
||||||
if (m_handle == SocketImpl::InvalidHandle)
|
NazaraAssert(m_handle != SocketImpl::InvalidHandle, "Socket must be created first");
|
||||||
return 0;
|
|
||||||
|
|
||||||
return SocketImpl::QuerySendBufferSize(m_handle);
|
return SocketImpl::QuerySendBufferSize(m_handle);
|
||||||
}
|
}
|
||||||
@@ -142,8 +140,9 @@ namespace Nz
|
|||||||
*/
|
*/
|
||||||
void AbstractSocket::SetReceiveBufferSize(std::size_t size)
|
void AbstractSocket::SetReceiveBufferSize(std::size_t size)
|
||||||
{
|
{
|
||||||
if (m_handle != SocketImpl::InvalidHandle)
|
NazaraAssert(m_handle != SocketImpl::InvalidHandle, "Socket must be created first");
|
||||||
SocketImpl::SetReceiveBufferSize(m_handle, size);
|
|
||||||
|
SocketImpl::SetReceiveBufferSize(m_handle, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -153,8 +152,9 @@ namespace Nz
|
|||||||
*/
|
*/
|
||||||
void AbstractSocket::SetSendBufferSize(std::size_t size)
|
void AbstractSocket::SetSendBufferSize(std::size_t size)
|
||||||
{
|
{
|
||||||
if (m_handle != SocketImpl::InvalidHandle)
|
NazaraAssert(m_handle != SocketImpl::InvalidHandle, "Socket must be created first");
|
||||||
SocketImpl::SetSendBufferSize(m_handle, size);
|
|
||||||
|
SocketImpl::SetSendBufferSize(m_handle, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
Reference in New Issue
Block a user