Remove some redundant includes, forward declares and similar pieces
This commit is contained in:
@@ -89,7 +89,6 @@ namespace AzNetworking
|
||||
virtual bool WasPacketAcked(ConnectionId connectionId, PacketId packetId) = 0;
|
||||
|
||||
//! Closes the network interface to stop accepting new incoming connections.
|
||||
//! @param port the listen port number this network interface will potentially bind to, 0 if it's a don't care
|
||||
//! @return boolean true if the operation was successful, false if it failed
|
||||
virtual bool StopListening() = 0;
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
namespace AzNetworking
|
||||
{
|
||||
class INetworkInterface;
|
||||
class IpAddress;
|
||||
}
|
||||
|
||||
namespace Multiplayer
|
||||
@@ -70,7 +69,7 @@ namespace Multiplayer
|
||||
//! Starts hosting a server
|
||||
//! @param port The port to listen for connection on
|
||||
//! @param isDedicated Whether the server is dedicated or client hosted
|
||||
virtual void StartHost(uint16_t port, bool isDedicated = true) = 0;
|
||||
virtual void StartHosting(uint16_t port, bool isDedicated = true) = 0;
|
||||
|
||||
//! Connects to the specified IP as a Client
|
||||
//! @param remoteAddress The domain or IP to connect to
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/Utils.h>
|
||||
#include <AzFramework/Session/ISessionHandlingRequests.h>
|
||||
#include <AzFramework/Spawnable/Spawnable.h>
|
||||
#include <AzNetworking/ConnectionLayer/IConnection.h>
|
||||
#include <AzNetworking/Framework/INetworking.h>
|
||||
|
||||
@@ -201,11 +201,10 @@ namespace Multiplayer
|
||||
AZ::TickBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void MultiplayerSystemComponent::StartHost(uint16_t port, bool isDedicated)
|
||||
void MultiplayerSystemComponent::StartHosting(uint16_t port, bool isDedicated)
|
||||
{
|
||||
InitializeMultiplayer(isDedicated ? MultiplayerAgentType::DedicatedServer : MultiplayerAgentType::ClientServer);
|
||||
INetworkInterface* networkInterface = AZ::Interface<INetworking>::Get()->RetrieveNetworkInterface(AZ::Name(MPNetworkInterfaceName));
|
||||
networkInterface->Listen(port);
|
||||
m_networkInterface->Listen(port);
|
||||
}
|
||||
|
||||
void MultiplayerSystemComponent::Connect(AZStd::string remoteAddress, uint16_t port)
|
||||
@@ -217,13 +216,11 @@ namespace Multiplayer
|
||||
|
||||
void MultiplayerSystemComponent::Terminate()
|
||||
{
|
||||
INetworkInterface* networkInterface = AZ::Interface<INetworking>::Get()->RetrieveNetworkInterface(AZ::Name(MPNetworkInterfaceName));
|
||||
|
||||
auto visitor = [](IConnection& connection) { connection.Disconnect(DisconnectReason::TerminatedByUser, TerminationEndpoint::Local); };
|
||||
networkInterface->GetConnectionSet().VisitConnections(visitor);
|
||||
m_networkInterface->GetConnectionSet().VisitConnections(visitor);
|
||||
if (GetAgentType() == MultiplayerAgentType::DedicatedServer || GetAgentType() == MultiplayerAgentType::ClientServer)
|
||||
{
|
||||
networkInterface->StopListening();
|
||||
m_networkInterface->StopListening();
|
||||
m_shutdownEvent.Signal(m_networkInterface);
|
||||
if (AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get() != nullptr)
|
||||
{
|
||||
@@ -681,7 +678,6 @@ namespace Multiplayer
|
||||
// Signal to session management that a user has left the server
|
||||
if (m_agentType == MultiplayerAgentType::DedicatedServer || m_agentType == MultiplayerAgentType::ClientServer)
|
||||
{
|
||||
|
||||
if (AZ::Interface<AzFramework::ISessionHandlingProviderRequests>::Get() != nullptr &&
|
||||
connection->GetConnectionRole() == ConnectionRole::Acceptor)
|
||||
{
|
||||
@@ -937,14 +933,12 @@ namespace Multiplayer
|
||||
|
||||
void host([[maybe_unused]] const AZ::ConsoleCommandContainer& arguments)
|
||||
{
|
||||
AZ::Interface<IMultiplayer>::Get()->StartHost(sv_port, sv_isDedicated);
|
||||
AZ::Interface<IMultiplayer>::Get()->StartHosting(sv_port, sv_isDedicated);
|
||||
}
|
||||
AZ_CONSOLEFREEFUNC(host, AZ::ConsoleFunctorFlags::DontReplicate, "Opens a multiplayer connection as a host for other clients to connect to");
|
||||
|
||||
void connect([[maybe_unused]] const AZ::ConsoleCommandContainer& arguments)
|
||||
{
|
||||
AzNetworking::IpAddress address;
|
||||
|
||||
if (arguments.size() < 1)
|
||||
{
|
||||
const AZ::CVarFixedString remoteAddress = cl_serveraddr;
|
||||
@@ -966,8 +960,6 @@ namespace Multiplayer
|
||||
int32_t portNumber = atol(portStr);
|
||||
AZ::Interface<IMultiplayer>::Get()->Connect(addressStr, portNumber);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
AZ_CONSOLEFREEFUNC(connect, AZ::ConsoleFunctorFlags::DontReplicate, "Opens a multiplayer connection to a remote host");
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace Multiplayer
|
||||
void AddConnectionAcquiredHandler(ConnectionAcquiredEvent::Handler& handler) override;
|
||||
void AddSessionInitHandler(SessionInitEvent::Handler& handler) override;
|
||||
void AddSessionShutdownHandler(SessionShutdownEvent::Handler& handler) override;
|
||||
void StartHost(uint16_t port, bool isDedicated = true) override;
|
||||
void StartHosting(uint16_t port, bool isDedicated = true) override;
|
||||
void Connect(AZStd::string remoteAddress, uint16_t port) override;
|
||||
void Terminate() override;
|
||||
void SendReadyForEntityUpdates(bool readyForEntityUpdates) override;
|
||||
|
||||
Reference in New Issue
Block a user