indent with tabs
This commit is contained in:
@@ -29,44 +29,44 @@ Connexion::Connexion(protocol::PacketDispatcher* dispatcher, network::TCPSocket&
|
||||
}
|
||||
|
||||
bool Connexion::UpdateSocket() {
|
||||
if (m_Socket.GetStatus() != network::Socket::Connected)
|
||||
return false;
|
||||
if (m_Socket.GetStatus() != network::Socket::Connected)
|
||||
return false;
|
||||
|
||||
while (true) {
|
||||
DataBuffer buffer;
|
||||
m_Socket.Receive(buffer, sizeof(std::uint64_t));
|
||||
if (buffer.GetSize() == 0)
|
||||
break;
|
||||
std::uint64_t packetLenght;
|
||||
buffer >> packetLenght;
|
||||
while (true) {
|
||||
DataBuffer buffer;
|
||||
m_Socket.Receive(buffer, sizeof(std::uint64_t));
|
||||
if (buffer.GetSize() == 0)
|
||||
break;
|
||||
std::uint64_t packetLenght;
|
||||
buffer >> packetLenght;
|
||||
|
||||
m_Socket.Receive(buffer, packetLenght);
|
||||
m_Socket.Receive(buffer, packetLenght);
|
||||
|
||||
DataBuffer decompressed = utils::Decompress(buffer, packetLenght);
|
||||
DataBuffer decompressed = utils::Decompress(buffer, packetLenght);
|
||||
|
||||
protocol::PacketType packetType;
|
||||
decompressed >> packetType;
|
||||
protocol::PacketType packetType;
|
||||
decompressed >> packetType;
|
||||
|
||||
PacketPtr packet = protocol::PacketFactory::CreatePacket(packetType, decompressed);
|
||||
GetDispatcher()->Dispatch(packet);
|
||||
}
|
||||
return true;
|
||||
PacketPtr packet = protocol::PacketFactory::CreatePacket(packetType, decompressed);
|
||||
GetDispatcher()->Dispatch(packet);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Connexion::Connect(const std::string& address, std::uint16_t port) {
|
||||
if (!m_Socket.Connect(address, port)) {
|
||||
return false;
|
||||
}
|
||||
m_Socket.SetBlocking(false);
|
||||
return true;
|
||||
if (!m_Socket.Connect(address, port)) {
|
||||
return false;
|
||||
}
|
||||
m_Socket.SetBlocking(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Connexion::SendPacket(const protocol::Packet* packet) {
|
||||
network::SendPacket(packet->Serialize(), m_Socket);
|
||||
network::SendPacket(packet->Serialize(), m_Socket);
|
||||
}
|
||||
|
||||
void Connexion::CloseConnection() {
|
||||
m_Socket.Disconnect();
|
||||
m_Socket.Disconnect();
|
||||
}
|
||||
|
||||
Connexion::~Connexion() {
|
||||
|
||||
Reference in New Issue
Block a user