mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-31 00:15:55 -04:00
Merge branch 'testing' into clang-profile-build
This commit is contained in:
+15
-19
@@ -56,29 +56,25 @@ elseif(UNIX)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
|
||||
# don't put anything too crazy in debug...and any common flags go into CMAKE_CXX_FLAGS
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -O0 -g3")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -Og -g3")
|
||||
|
||||
# funroll loops and everything else potentially crazy for performance here
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -Ofast -funroll-loops")
|
||||
|
||||
# TODO: The below flags will enhance security but at the cost of performance, arguably...
|
||||
# currently with them SWG cluster idles at ~17-18% of 24 cpus, and ata round ~14-17% without
|
||||
# there is likely also a latency/speed impact as well
|
||||
# not sure if needed or not - https://wiki.debian.org/Hardening
|
||||
# ============================================================================================
|
||||
# -fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fPIE -ftrapv
|
||||
# -D_FORTIFY_SOURCE=2 is generally considered safe but crashes datatabletool when built with gcc
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -D_GLIBCXX_USE_CXX11_ABI=0 \
|
||||
-m32 -pipe -march=native -mtune=native \
|
||||
# Ofast doesn't work with gcc builds
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast")
|
||||
endif()
|
||||
|
||||
# funroll loops and everything else potentially crazy for performance here
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -funroll-loops")
|
||||
|
||||
# our "always on" flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -m32 -pipe -march=native -mtune=native \
|
||||
-Wformat -Wno-overloaded-virtual -Wno-missing-braces -Wno-format \
|
||||
-Wno-write-strings -Wno-unknown-pragmas \
|
||||
-Wno-uninitialized -Wno-reorder")
|
||||
|
||||
# we could use libc++ with gcc too but let's roll with default there
|
||||
#if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
#endif()
|
||||
|
||||
add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500)
|
||||
endif()
|
||||
|
||||
@@ -33,9 +33,10 @@
|
||||
#include "serverNetworkMessages/UploadCharacterMessage.h"
|
||||
#include "sharedLog/Log.h"
|
||||
#include "sharedNetworkMessages/ConsoleChannelMessages.h"
|
||||
#include "sharedNetworkMessages/GenericValueTypeMessage.h"
|
||||
#include "unicodeArchive/UnicodeArchive.h"
|
||||
|
||||
#include "sharedNetworkMessages/GenericValueTypeMessage.h"
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
// ======================================================================
|
||||
@@ -126,11 +127,16 @@ void GameServerConnection::onReceive(Archive::ByteStream const &message)
|
||||
}
|
||||
case constcrc("TransferReplyNameValidation") :
|
||||
{
|
||||
GenericValueTypeMessage<std::pair<std::string, TransferCharacterData> > const replyNameValidation(ri);
|
||||
GenericValueTypeMessage<std::map<std::string, TransferCharacterData> > const replyNameValidation(ri);
|
||||
auto i = replyNameValidation.getValue().begin();
|
||||
|
||||
if (replyNameValidation.getValue().second.getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server)
|
||||
if (i == replyNameValidation.getValue().end()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (i->second.getTransferRequestSource() == TransferRequestMoveValidation::TRS_transfer_server)
|
||||
{
|
||||
LOG("CustomerService", ("CharacterTransfer: Received TransferReplyNameValidation from GameServer, forwarding to TransferServer : %s", replyNameValidation.getValue().second.toString().c_str()));
|
||||
LOG("CustomerService", ("CharacterTransfer: Received TransferReplyNameValidation from GameServer, forwarding to TransferServer : %s", i->second.toString().c_str()));
|
||||
CentralServer::getInstance().sendToTransferServer(replyNameValidation);
|
||||
}
|
||||
else
|
||||
@@ -138,14 +144,14 @@ void GameServerConnection::onReceive(Archive::ByteStream const &message)
|
||||
// pass reply back to the source galaxy for handling, which is to
|
||||
// either display an error message to the user if the request failed,
|
||||
// or to start the transfer process if the request succeeds
|
||||
LOG("CustomerService", ("CharacterTransfer: Received TransferReplyNameValidation from GameServer, forwarding to source galaxy CentralServer : %s", replyNameValidation.getValue().second.toString().c_str()));
|
||||
LOG("CustomerService", ("CharacterTransfer: Received TransferReplyNameValidation from GameServer, forwarding to source galaxy CentralServer : %s", i->second.toString().c_str()));
|
||||
CentralServer::getInstance().sendToArbitraryLoginServer(replyNameValidation);
|
||||
|
||||
// if the request succeeded, also disconnect any clients with a connection to SWG services on this (the target) galaxy
|
||||
if (replyNameValidation.getValue().second.getIsValidName() && (replyNameValidation.getValue().second.getTransferRequestSource() != TransferRequestMoveValidation::TRS_ingame_freects_command_validate) && (replyNameValidation.getValue().second.getTransferRequestSource() != TransferRequestMoveValidation::TRS_ingame_cts_command_validate))
|
||||
if (i->second.getIsValidName() && (i->second.getTransferRequestSource() != TransferRequestMoveValidation::TRS_ingame_freects_command_validate) && (i->second.getTransferRequestSource() != TransferRequestMoveValidation::TRS_ingame_cts_command_validate))
|
||||
{
|
||||
GenericValueTypeMessage<unsigned int> kickSource("TransferKickConnectedClients", replyNameValidation.getValue().second.getSourceStationId());
|
||||
GenericValueTypeMessage<unsigned int> kickDestination("TransferKickConnectedClients", replyNameValidation.getValue().second.getDestinationStationId());
|
||||
GenericValueTypeMessage<unsigned int> kickSource("TransferKickConnectedClients", i->second.getSourceStationId());
|
||||
GenericValueTypeMessage<unsigned int> kickDestination("TransferKickConnectedClients", i->second.getDestinationStationId());
|
||||
CentralServer::getInstance().sendToAllLoginServers(kickSource);
|
||||
CentralServer::getInstance().sendToAllLoginServers(kickDestination);
|
||||
CentralServer::getInstance().sendToAllConnectionServers(kickSource, true);
|
||||
|
||||
@@ -228,27 +228,32 @@ void CentralServerConnection::onReceive(const Archive::ByteStream & message)
|
||||
}
|
||||
case constcrc("TransferReplyNameValidation") :
|
||||
{
|
||||
const GenericValueTypeMessage<std::pair<std::string, TransferCharacterData> > replyNameValidation(ri);
|
||||
if(!replyNameValidation.getValue().second.getIsMoveRequest())
|
||||
const GenericValueTypeMessage<std::map<std::string, TransferCharacterData> > replyNameValidation(ri);
|
||||
auto i = replyNameValidation.getValue().begin();
|
||||
|
||||
if (i == replyNameValidation.getValue().end()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(!i->second.getIsMoveRequest())
|
||||
{
|
||||
LOG("CustomerService", ("CharacterTransfer: Received replyNameValidation for move validation request. (%s) %s", replyNameValidation.getValue().first.c_str(), replyNameValidation.getValue().second.toString().c_str()));
|
||||
TransferServer::replyValidateMove(replyNameValidation.getValue().second);
|
||||
LOG("CustomerService", ("CharacterTransfer: Received replyNameValidation for move validation request. (%s) %s", i->first.c_str(), i->second.toString().c_str()));
|
||||
TransferServer::replyValidateMove(i->second);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(TransferServer::isRename(replyNameValidation.getValue().second))
|
||||
if(TransferServer::isRename(i->second))
|
||||
{
|
||||
LOG("CustomerService", ("CharacterTransfer: Received replyNameValidation for rename request, starting character rename protocol. (%s) %s", replyNameValidation.getValue().first.c_str(), replyNameValidation.getValue().second.toString().c_str()));
|
||||
const GenericValueTypeMessage<TransferCharacterData> renameCharacter("TransferRenameCharacter", replyNameValidation.getValue().second);
|
||||
CentralServerConnection * centralServerConnection = CentralServerConnection::getCentralServerConnectionForGalaxy(replyNameValidation.getValue().second.getSourceGalaxy());
|
||||
LOG("CustomerService", ("CharacterTransfer: Received replyNameValidation for rename request, starting character rename protocol. (%s) %s", i->first.c_str(), i->second.toString().c_str()));
|
||||
const GenericValueTypeMessage<TransferCharacterData> renameCharacter("TransferRenameCharacter", i->second);
|
||||
CentralServerConnection * centralServerConnection = CentralServerConnection::getCentralServerConnectionForGalaxy(i->second.getSourceGalaxy());
|
||||
if(centralServerConnection)
|
||||
{
|
||||
centralServerConnection->send(renameCharacter, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
TransferServer::transferCreateCharacterFailed(replyNameValidation.getValue().second);
|
||||
}
|
||||
TransferServer::transferCreateCharacterFailed(i->second); }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1340,11 +1340,14 @@ void GameServer::receiveMessage(const MessageDispatch::Emitter & source, const M
|
||||
LoadObjectMessage const t(ri);
|
||||
|
||||
ServerObject *const target = ServerWorld::findObjectByNetworkId(t.getId());
|
||||
if (target)
|
||||
if (target) {
|
||||
createRemoteProxy(t.getProcess(), target);
|
||||
else
|
||||
WARNING(true, ("Told to create object %s on %d we know nothing about (received LoadObjectMessage for an object not on this server, PlanetServer is probably confused)", t
|
||||
.getId().getValueString().c_str(), t.getProcess()));
|
||||
} else {
|
||||
WARNING(true, ("Told to create object %s on %d we know nothing about. Requesting unload.", t.getId().getValueString().c_str(), t.getProcess()));
|
||||
|
||||
UnloadObjectMessage const t(ri);
|
||||
target->unload();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case constcrc("UnloadObjectMessage") : {
|
||||
|
||||
+1
-2
@@ -104,9 +104,8 @@ public:
|
||||
|
||||
void setCSToolId (const unsigned int toolId);
|
||||
|
||||
private:
|
||||
TransferCharacterData();
|
||||
|
||||
private:
|
||||
friend class Archive::AutoVariable<TransferCharacterData>;
|
||||
friend struct std::pair<std::string, TransferCharacterData>;
|
||||
friend void Archive::get(Archive::ReadIterator & source, TransferCharacterData & target);
|
||||
|
||||
Reference in New Issue
Block a user