mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-12-21 08:47:12 +01:00
issiauskinau kad checksum yra nahuj reikalingas ir kad onConnect turejo buti uzkomentuotas. Reikia issiaiskinti kodel luzta onLogin clientas. Kitus failus reikia perziureti ir isvalyti siuksles
This commit is contained in:
@@ -187,29 +187,13 @@ void Connection::parsePacket(const boost::system::error_code& error)
|
||||
return;
|
||||
}
|
||||
|
||||
//Check packet checksum
|
||||
uint32_t checksum;
|
||||
int32_t len = msg.getLength() - msg.getBufferPosition() - NetworkMessage::CHECKSUM_LENGTH;
|
||||
if (len > 0) {
|
||||
checksum = adlerChecksum(msg.getBuffer() + msg.getBufferPosition() + NetworkMessage::CHECKSUM_LENGTH, len);
|
||||
}
|
||||
else {
|
||||
checksum = 0;
|
||||
}
|
||||
|
||||
uint32_t recvChecksum = msg.get<uint32_t>();
|
||||
if (recvChecksum != checksum) {
|
||||
// it might not have been the checksum, step back
|
||||
msg.skipBytes(-NetworkMessage::CHECKSUM_LENGTH);
|
||||
}
|
||||
|
||||
if (!receivedFirst) {
|
||||
// First message received
|
||||
receivedFirst = true;
|
||||
|
||||
if (!protocol) {
|
||||
// Game protocol has already been created at this point
|
||||
protocol = service_port->make_protocol(recvChecksum == checksum, msg, shared_from_this());
|
||||
protocol = service_port->make_protocol(msg, shared_from_this());
|
||||
if (!protocol) {
|
||||
close(FORCE_CLOSE);
|
||||
return;
|
||||
@@ -242,6 +226,7 @@ void Connection::parsePacket(const boost::system::error_code& error)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Connection::send(const OutputMessage_ptr& msg)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lockClass(connectionLock);
|
||||
|
||||
Reference in New Issue
Block a user