From 39509c3508b213c0ccfec0495ad1fdae92207239 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 29 Sep 2016 21:53:18 -0500 Subject: [PATCH] fix one previous file, setup another --- .../src/shared/PlanetServerConnection.cpp | 40 ++++++++------ .../src/shared/GameServerConnection.cpp | 53 +++++++++++-------- 2 files changed, 54 insertions(+), 39 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/PlanetServerConnection.cpp b/engine/server/application/CentralServer/src/shared/PlanetServerConnection.cpp index c8181eda..a5930b86 100755 --- a/engine/server/application/CentralServer/src/shared/PlanetServerConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/PlanetServerConnection.cpp @@ -75,27 +75,33 @@ void PlanetServerConnection::onReceive(Archive::ByteStream const &message) if (!m_forwardDestinationServers.empty()) { - switch (msgType) { - case constcrc("EndForward"): { - if (--m_forwardCounts.back() == 0) { - m_forwardCounts.pop_back(); - m_forwardDestinationServers.pop_back(); + if (isMessageForwardable(msgType)) + { + m_forwardMessages.push_back(std::make_pair(message, m_forwardDestinationServers.back())); + return; + } else { + switch (msgType) { + case constcrc("EndForward"): { + if (--m_forwardCounts.back() == 0) { + m_forwardCounts.pop_back(); + m_forwardDestinationServers.pop_back(); - if (m_forwardDestinationServers.empty()) { - pushAndClearObjectForwarding(); + if (m_forwardDestinationServers.empty()) { + pushAndClearObjectForwarding(); + } } + return; } - return; - } - case constcrc("BeginForward") : { - GenericValueTypeMessage > const beginForwardMessage(ri); - if (beginForwardMessage.getValue() == m_forwardDestinationServers.back()) - ++m_forwardCounts.back(); - else { - m_forwardCounts.push_back(1); - m_forwardDestinationServers.push_back(beginForwardMessage.getValue()); + case constcrc("BeginForward") : { + GenericValueTypeMessage > const beginForwardMessage(ri); + if (beginForwardMessage.getValue() == m_forwardDestinationServers.back()) + ++m_forwardCounts.back(); + else { + m_forwardCounts.push_back(1); + m_forwardDestinationServers.push_back(beginForwardMessage.getValue()); + } + return; } - return; } } } diff --git a/engine/server/application/PlanetServer/src/shared/GameServerConnection.cpp b/engine/server/application/PlanetServer/src/shared/GameServerConnection.cpp index 82eb4d35..1fb0d52c 100755 --- a/engine/server/application/PlanetServer/src/shared/GameServerConnection.cpp +++ b/engine/server/application/PlanetServer/src/shared/GameServerConnection.cpp @@ -15,6 +15,8 @@ #include "sharedLog/Log.h" #include "sharedNetworkMessages/GenericValueTypeMessage.h" +#include "sharedFoundation/CrcConstexpr.hpp" + // ====================================================================== GameServerConnection::GameServerConnection(UdpConnectionMT *u, TcpClient *t) : @@ -62,39 +64,46 @@ void GameServerConnection::onReceive(Archive::ByteStream const &message) GameNetworkMessage msg(ri); ri = message.begin(); + const uint32 messageType = msg.getType(); + if (!m_forwardDestinationServers.empty()) { - if (isMessageForwardable(msg.getType())) + if (isMessageForwardable(messageType)) { m_forwardMessages.push_back(std::make_pair(message, m_forwardDestinationServers.back())); return; } - else if (msg.isType("EndForward")) + else { - if (--m_forwardCounts.back() == 0) - { - m_forwardCounts.pop_back(); - m_forwardDestinationServers.pop_back(); - if (m_forwardDestinationServers.empty()) - pushAndClearObjectForwarding(); + switch (msgType) { + case constcrc("EndForward") : + { + if (--m_forwardCounts.back() == 0) + { + m_forwardCounts.pop_back(); + m_forwardDestinationServers.pop_back(); + if (m_forwardDestinationServers.empty()) + pushAndClearObjectForwarding(); + } + return; + } + case constcrc("BeginForward") : + { + GenericValueTypeMessage > const beginForwardMessage(ri); + if (beginForwardMessage.getValue() == m_forwardDestinationServers.back()) + ++m_forwardCounts.back(); + else + { + m_forwardCounts.push_back(1); + m_forwardDestinationServers.push_back(beginForwardMessage.getValue()); + } + return; + } } - return; - } - else if (msg.isType("BeginForward")) - { - GenericValueTypeMessage > const beginForwardMessage(ri); - if (beginForwardMessage.getValue() == m_forwardDestinationServers.back()) - ++m_forwardCounts.back(); - else - { - m_forwardCounts.push_back(1); - m_forwardDestinationServers.push_back(beginForwardMessage.getValue()); - } - return; } } - if (msg.isType("BeginForward")) + if (msgType == constcrc("BeginForward")) { GenericValueTypeMessage > const beginForwardMessage(ri);