Network/ENetHost: Add AllowsIncomingConnections method
This commit is contained in:
parent
d435826651
commit
518b8697de
|
|
@ -220,6 +220,7 @@ Nazara Engine:
|
||||||
- ⚠ Removed Texture(const Image\*) constructor, use Texture::LoadFromImage instead
|
- ⚠ Removed Texture(const Image\*) constructor, use Texture::LoadFromImage instead
|
||||||
- ⚠ TextDrawers now use floating-point internally and to exposes their Bounds (AbstractTextDrawer::GetBounds() now returns a Rectf)
|
- ⚠ TextDrawers now use floating-point internally and to exposes their Bounds (AbstractTextDrawer::GetBounds() now returns a Rectf)
|
||||||
- Added [SimpleTextDrawer|RichTextDrawer] character and line spacing offset properties
|
- Added [SimpleTextDrawer|RichTextDrawer] character and line spacing offset properties
|
||||||
|
- Added ENetHost::AllowsIncomingConnections(bool) to disable/re-enable server peers connection
|
||||||
|
|
||||||
Nazara Development Kit:
|
Nazara Development Kit:
|
||||||
- Added ImageWidget (#139)
|
- Added ImageWidget (#139)
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,8 @@ namespace Nz
|
||||||
ENetHost(ENetHost&&) = default;
|
ENetHost(ENetHost&&) = default;
|
||||||
inline ~ENetHost();
|
inline ~ENetHost();
|
||||||
|
|
||||||
|
inline void AllowsIncomingConnections(bool allow = true);
|
||||||
|
|
||||||
void Broadcast(UInt8 channelId, ENetPacketFlags flags, NetPacket&& packet);
|
void Broadcast(UInt8 channelId, ENetPacketFlags flags, NetPacket&& packet);
|
||||||
|
|
||||||
bool CheckEvents(ENetEvent* event);
|
bool CheckEvents(ENetEvent* event);
|
||||||
|
|
@ -56,6 +58,8 @@ namespace Nz
|
||||||
bool Create(const IpAddress& listenAddress, std::size_t peerCount, std::size_t channelCount, UInt32 incomingBandwidth, UInt32 outgoingBandwidth);
|
bool Create(const IpAddress& listenAddress, std::size_t peerCount, std::size_t channelCount, UInt32 incomingBandwidth, UInt32 outgoingBandwidth);
|
||||||
inline void Destroy();
|
inline void Destroy();
|
||||||
|
|
||||||
|
inline bool DoesAllowIncomingConnections() const;
|
||||||
|
|
||||||
void Flush();
|
void Flush();
|
||||||
|
|
||||||
inline IpAddress GetBoundAddress() const;
|
inline IpAddress GetBoundAddress() const;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,13 @@ namespace Nz
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void ENetHost::AllowsIncomingConnections(bool allow)
|
||||||
|
{
|
||||||
|
NazaraAssert(m_address.IsValid() && !m_address.IsLoopback(), "Only server hosts can allow incoming connections");
|
||||||
|
|
||||||
|
m_allowsIncomingConnections = allow;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool ENetHost::Create(NetProtocol protocol, UInt16 port, std::size_t peerCount, std::size_t channelCount)
|
inline bool ENetHost::Create(NetProtocol protocol, UInt16 port, std::size_t peerCount, std::size_t channelCount)
|
||||||
{
|
{
|
||||||
NazaraAssert(protocol != NetProtocol_Unknown, "Invalid protocol");
|
NazaraAssert(protocol != NetProtocol_Unknown, "Invalid protocol");
|
||||||
|
|
@ -54,6 +61,11 @@ namespace Nz
|
||||||
m_socket.Close();
|
m_socket.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool ENetHost::DoesAllowIncomingConnections() const
|
||||||
|
{
|
||||||
|
return m_allowsIncomingConnections;
|
||||||
|
}
|
||||||
|
|
||||||
inline IpAddress ENetHost::GetBoundAddress() const
|
inline IpAddress ENetHost::GetBoundAddress() const
|
||||||
{
|
{
|
||||||
return m_address;
|
return m_address;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue