Cleanup and consolidate MPSystemComponent and add StopListening to AzNetworking

This commit is contained in:
puvvadar
2021-06-17 16:17:36 -07:00
parent a86524122d
commit a748c2e152
9 changed files with 103 additions and 59 deletions
@@ -359,6 +359,21 @@ namespace AzNetworking
return connection->WasPacketAcked(packetId);
}
bool UdpNetworkInterface::StopListening()
{
if (!m_socket->IsOpen())
{
AZ_Assert(false, "StopListen cannot be invoked on an already closed network interface");
return false;
}
m_port = 0;
m_readerThread.UnregisterSocket(m_socket.get());
m_allowIncomingConnections = false;
m_socket->Close();
return true;
}
bool UdpNetworkInterface::Disconnect(ConnectionId connectionId, DisconnectReason reason)
{
IConnection* connection = m_connectionSet.GetConnection(connectionId);
@@ -60,6 +60,7 @@ namespace AzNetworking
bool SendReliablePacket(ConnectionId connectionId, const IPacket& packet) override;
PacketId SendUnreliablePacket(ConnectionId connectionId, const IPacket& packet) override;
bool WasPacketAcked(ConnectionId connectionId, PacketId packetId) override;
bool StopListening() override;
bool Disconnect(ConnectionId connectionId, DisconnectReason reason) override;
//! @}