FeatherMC/src/DedicatedServer.cpp

36 lines
865 B
C++
Raw Normal View History

2020-07-24 10:17:36 +01:00
#include "DedicatedServer.h"
2020-07-25 04:44:00 +01:00
#include "config/ServerProperties.h"
2020-07-24 10:17:36 +01:00
namespace Feather
{
2020-07-25 04:44:00 +01:00
DedicatedServer::DedicatedServer(ServerProperties* properties) :
m_properties(properties),
2020-07-29 01:46:31 +01:00
m_listener(properties->serverPort.GetValue(), this),
2020-07-25 04:44:00 +01:00
m_status()
2020-07-24 10:17:36 +01:00
{
2020-07-25 04:44:00 +01:00
m_status.descriptionText = properties->motd.GetValue();
m_status.maxPlayers = properties->maxPlayers.GetValue();
2020-07-25 03:01:16 +01:00
while (1)
{
}
2020-07-24 10:17:36 +01:00
}
DedicatedServer::~DedicatedServer()
{
}
2020-07-29 01:46:31 +01:00
void DedicatedServer::OnClientConnect(Network::TCPClient&& client)
{
auto [clients, lock] = m_clients.borrow();
clients.emplace_back(std::move(client));
}
2020-07-29 15:34:10 +01:00
void DedicatedServer::OnClientDisconnect(const Network::TCPClient& client)
2020-07-29 01:46:31 +01:00
{
auto [clients, lock] = m_clients.borrow();
2020-07-29 15:34:10 +01:00
clients.remove(client);
2020-07-29 01:46:31 +01:00
}
2020-07-24 10:17:36 +01:00
}