Danbias/Code/Game/DanBiasServer/ServerObjects/NetworkSession.cpp

49 lines
938 B
C++
Raw Normal View History

2013-12-13 23:47:16 +01:00
#include "ClientObject.h"
2013-12-12 09:33:59 +01:00
#include "NetworkSession.h"
#include <mutex>
2013-12-12 09:33:59 +01:00
namespace DanBias
{
NetworkSession::NetworkSession()
{
2013-12-12 09:33:59 +01:00
}
NetworkSession::~NetworkSession()
{
2013-12-12 09:33:59 +01:00
}
2013-12-13 23:47:16 +01:00
void NetworkSession::AttachClient(Utility::DynamicMemory::SmartPointer<ClientObject> client)
2013-12-12 09:33:59 +01:00
{
2013-12-13 23:47:16 +01:00
for (unsigned int i = 0; i < this->clients.size(); i++)
{
if(!this->clients[i])
{
this->clients[i] = client;
//this->clients[i]->SetPostbox(&this->box);
return;
}
}
this->clients.push_back(client);
2013-12-12 09:33:59 +01:00
}
void NetworkSession::DetachClient(short ID)
{
//this->clients[0]->NetClient_Object()->
2013-12-12 09:33:59 +01:00
}
void NetworkSession::DetachClient()
2013-12-12 09:33:59 +01:00
{
for (unsigned int i = 0; i < this->clients.size(); i++)
{
this->clients[i] = 0;
}
2013-12-12 09:33:59 +01:00
}
2013-12-12 09:33:59 +01:00
void NetworkSession::Kick()
{
for (unsigned int i = 0; i < this->clients.size(); i++)
{
this->clients[i]->NetClient_Object()->Disconnect();
this->clients[i] = 0;
}
2013-12-12 09:33:59 +01:00
}
}//End namespace DanBias