mirror of
https://github.com/SWG-Source/src.git
synced 2026-08-02 02:15:58 -04:00
we can now build with gcc6/stdc++6
This commit is contained in:
+14
-17
@@ -58,27 +58,24 @@ elseif(UNIX)
|
||||
# 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 -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 \
|
||||
# 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++17 \
|
||||
-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 -DSTELLA_INTERNAL -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
|
||||
{
|
||||
|
||||
+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);
|
||||
|
||||
@@ -373,7 +373,7 @@ void TcpClient::queryConnect ()
|
||||
pfd.fd = m_socket;
|
||||
pfd.events = POLLOUT;
|
||||
pfd.revents = 0;
|
||||
int pollResult = poll(&pfd, 1, 3000);
|
||||
int pollResult = poll(&pfd, 1, 0);
|
||||
if(pollResult > 0)
|
||||
{
|
||||
if (pfd.revents & POLLERR)
|
||||
@@ -483,7 +483,7 @@ void TcpClient::update()
|
||||
pfd.fd = m_socket;
|
||||
pfd.events = POLLIN|POLLHUP;
|
||||
pfd.revents = 0;
|
||||
int pollResult = poll (&pfd, 1, 3000);
|
||||
int pollResult = poll (&pfd, 1, 0);
|
||||
// POLLERR is mutually exclusive with POLLIN and POLLHUP.
|
||||
// POLLIN and POLLHUP are not consistent cross-platform. Additionally,
|
||||
// a POLLHUP doesn't mean that there's not data available. The best,
|
||||
|
||||
Reference in New Issue
Block a user