mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-31 00:15:55 -04:00
Merge branch 'testing' of git.stellabellum.net:staff/src into testing
This commit is contained in:
@@ -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);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -91,7 +91,7 @@ public:
|
||||
|
||||
void handleGameServerForLoginMessage(uint32 serverId);
|
||||
void onIdValidated(bool canLogin, bool canCreateRegularCharacter, bool canCreateJediCharacter, bool canSkipTutorial, std::vector<std::pair<NetworkId, std::string> > const & consumedRewardEvents, std::vector<std::pair<NetworkId, std::string> > const & claimedRewardItems);
|
||||
void onValidateClient (uint32 id, const std::string & username, bool, const char*, uint32 gameFeatures, uint32 subscriptionFeatures, unsigned int entitlementTotalTime, unsigned int entitlementEntitledTime, unsigned int entitlementTotalTimeSinceLastLogin, unsigned int entitlementEntitledTimeSinceLastLogin, int buddyPoints);
|
||||
void onValidateClient (StationId id, const std::string & username, bool, const char*, uint32 gameFeatures, uint32 subscriptionFeatures, unsigned int entitlementTotalTime, unsigned int entitlementEntitledTime, unsigned int entitlementTotalTimeSinceLastLogin, unsigned int entitlementEntitledTimeSinceLastLogin, int buddyPoints);
|
||||
void onCharacterValidated(bool isValid, const NetworkId &character, const std::string &characterName, const NetworkId &container, const std::string &scene, const Vector &coordinates);
|
||||
static std::string describeAccount(const ClientConnection *);
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ void ConfigConnectionServer::install(void)
|
||||
|
||||
data = new ConfigConnectionServer::Data;
|
||||
|
||||
KEY_STRING (sessionURL, "");
|
||||
KEY_STRING (centralServerAddress, "localhost");
|
||||
KEY_INT (centralServerPort, 0);
|
||||
KEY_STRING (clientServiceBindInterface, "");
|
||||
|
||||
@@ -2,477 +2,483 @@
|
||||
// copyright 2000 Verant Interactive
|
||||
// Author: Justin Randall
|
||||
|
||||
#ifndef _ConfigConnectionServer_H
|
||||
#define _ConfigConnectionServer_H
|
||||
#ifndef _ConfigConnectionServer_H
|
||||
#define _ConfigConnectionServer_H
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
class ConfigConnectionServer
|
||||
{
|
||||
class ConfigConnectionServer {
|
||||
public:
|
||||
struct Data
|
||||
{
|
||||
const char* centralServerAddress;
|
||||
int centralServerPort;
|
||||
int clientServicePortPublic;
|
||||
int clientServicePortPrivate;
|
||||
int clientOverflowLimit;
|
||||
int gameServicePort;
|
||||
const char * clusterName;
|
||||
bool disableWorldSnapshot;
|
||||
int maxClients;
|
||||
int pingPort;
|
||||
bool spamLimitEnabled;
|
||||
int spamLimitResetTimeMs;
|
||||
int spamLimitResetScaleFactor;
|
||||
int spamLimitBytesPerSec;
|
||||
int spamLimitPacketsPerSec;
|
||||
bool startPublicServer;
|
||||
const char * chatServiceBindInterface;
|
||||
const char * clientServiceBindInterface;
|
||||
const char * customerServiceBindInterface;
|
||||
const char * gameServiceBindInterface;
|
||||
bool compressClientNetworkTraffic;
|
||||
int crashRecoveryTimeout;
|
||||
bool shouldSleep;
|
||||
int clientMaxOutstandingPackets;
|
||||
int clientMaxRawPacketSize;
|
||||
int clientMaxConnections;
|
||||
int clientFragmentSize;
|
||||
int clientMaxDataHoldTime;
|
||||
int clientHashTableSize;
|
||||
int lagReportThreshold;
|
||||
int maxConnectionsPerIP;
|
||||
struct Data {
|
||||
const char *sessionURL;
|
||||
const char *centralServerAddress;
|
||||
int centralServerPort;
|
||||
int clientServicePortPublic;
|
||||
int clientServicePortPrivate;
|
||||
int clientOverflowLimit;
|
||||
int gameServicePort;
|
||||
const char *clusterName;
|
||||
bool disableWorldSnapshot;
|
||||
int maxClients;
|
||||
int pingPort;
|
||||
bool spamLimitEnabled;
|
||||
int spamLimitResetTimeMs;
|
||||
int spamLimitResetScaleFactor;
|
||||
int spamLimitBytesPerSec;
|
||||
int spamLimitPacketsPerSec;
|
||||
bool startPublicServer;
|
||||
const char *chatServiceBindInterface;
|
||||
const char *clientServiceBindInterface;
|
||||
const char *customerServiceBindInterface;
|
||||
const char *gameServiceBindInterface;
|
||||
bool compressClientNetworkTraffic;
|
||||
int crashRecoveryTimeout;
|
||||
bool shouldSleep;
|
||||
int clientMaxOutstandingPackets;
|
||||
int clientMaxRawPacketSize;
|
||||
int clientMaxConnections;
|
||||
int clientFragmentSize;
|
||||
int clientMaxDataHoldTime;
|
||||
int clientHashTableSize;
|
||||
int lagReportThreshold;
|
||||
int maxConnectionsPerIP;
|
||||
|
||||
bool validateStationKey;
|
||||
const char * sessionServers;
|
||||
int sessionType;
|
||||
bool disableSessionLogout;
|
||||
bool sessionRecordPlayTime;
|
||||
bool disconnectOnInactive;
|
||||
bool disconnectFreeTrialOnInactive;
|
||||
const char * adminAccountDataTable;
|
||||
bool validateStationKey;
|
||||
const char *sessionServers;
|
||||
int sessionType;
|
||||
bool disableSessionLogout;
|
||||
bool sessionRecordPlayTime;
|
||||
bool disconnectOnInactive;
|
||||
bool disconnectFreeTrialOnInactive;
|
||||
const char *adminAccountDataTable;
|
||||
|
||||
float timeBetweenSessionUpdates;
|
||||
|
||||
int defaultGameFeatures;
|
||||
int defaultSubscriptionFeatures;
|
||||
int requiredSubscriptionBits;
|
||||
int requiredGameBits;
|
||||
bool setJtlRetailIfBetaIsSet;
|
||||
bool setEpisode3RetailIfBetaIsSet;
|
||||
bool setTrialsOfObiwanRetailIfBetaIsSet;
|
||||
float timeBetweenSessionUpdates;
|
||||
|
||||
int disabledFeatureBits;
|
||||
int defaultGameFeatures;
|
||||
int defaultSubscriptionFeatures;
|
||||
int requiredSubscriptionBits;
|
||||
int requiredGameBits;
|
||||
bool setJtlRetailIfBetaIsSet;
|
||||
bool setEpisode3RetailIfBetaIsSet;
|
||||
bool setTrialsOfObiwanRetailIfBetaIsSet;
|
||||
|
||||
bool validateClientVersion;
|
||||
int disabledFeatureBits;
|
||||
|
||||
int connectionServerNumber;
|
||||
int fakeBuddyPoints;
|
||||
bool validateClientVersion;
|
||||
|
||||
int connectionServerNumber;
|
||||
int fakeBuddyPoints;
|
||||
|
||||
|
||||
const char * altPublicBindAddress;
|
||||
};
|
||||
const char *altPublicBindAddress;
|
||||
};
|
||||
|
||||
|
||||
static const char * getCentralServerAddress ();
|
||||
static const uint16 getCentralServerPort ();
|
||||
static const int getClientOverflowLimit ();
|
||||
static const char * getClientServiceBindInterface ();
|
||||
static const uint16 getClientServicePortPrivate ();
|
||||
static const uint16 getClientServicePortPublic ();
|
||||
static const char * getClusterName ();
|
||||
static bool getDisableWorldSnapshot ();
|
||||
static const uint16 getGameServicePort ();
|
||||
static const int getMaxClients ();
|
||||
static const uint16 getPingPort ();
|
||||
static const bool getSpamLimitEnabled ();
|
||||
static const unsigned int getSpamLimitResetTimeMs ();
|
||||
static const unsigned int getSpamLimitResetScaleFactor ();
|
||||
static const unsigned int getSpamLimitBytesPerSec ();
|
||||
static const unsigned int getSpamLimitPacketsPerSec ();
|
||||
static const bool getStartPublicServer ();
|
||||
static const char * getChatServiceBindInterface ();
|
||||
static const char * getCustomerServiceBindInterface ();
|
||||
static const char * getGameServiceBindInterface ();
|
||||
static const bool getCompressClientNetworkTraffic ();
|
||||
static void install ();
|
||||
static void remove ();
|
||||
static const uint getCrashRecoveryTimeout ();
|
||||
static bool getShouldSleep ();
|
||||
static const int getClientMaxOutstandingPackets();
|
||||
static const int getClientMaxRawPacketSize ();
|
||||
static const int getClientMaxConnections ();
|
||||
static const int getClientFragmentSize ();
|
||||
static const int getClientMaxDataHoldTime ();
|
||||
static const int getClientHashTableSize ();
|
||||
static const int getLagReportThreshold ();
|
||||
static const char *getSessionURL();
|
||||
|
||||
static bool getValidateStationKey();
|
||||
static const char * getSessionServers();
|
||||
static const int getSessionType();
|
||||
static bool getDisableSessionLogout();
|
||||
static bool getSessionRecordPlayTime();
|
||||
static bool getDisconnectOnInactive();
|
||||
static bool getDisconnectFreeTrialOnInactive();
|
||||
|
||||
static const char * getAdminAccountDataTable (void);
|
||||
static const char *getCentralServerAddress();
|
||||
|
||||
static int getNumberOfSessionServers();
|
||||
static char const * getSessionServer(int index);
|
||||
static float getTimeBetweenSessionUpdates();
|
||||
static const uint16 getCentralServerPort();
|
||||
|
||||
static const uint32 getDefaultGameFeatures ();
|
||||
static const uint32 getDefaultSubscriptionFeatures();
|
||||
static uint32 getRequiredSubscriptionBits();
|
||||
static uint32 getRequiredGameBits();
|
||||
static bool getSetJtlRetailIfBetaIsSet();
|
||||
static bool getSetEpisode3RetailIfBetaIsSet();
|
||||
static bool getSetTrialsOfObiwanRetailIfBetaIsSet();
|
||||
static const int getClientOverflowLimit();
|
||||
|
||||
static int getDisabledFeatureBits();
|
||||
static const char *getClientServiceBindInterface();
|
||||
|
||||
static bool getValidateClientVersion();
|
||||
static const uint16 getClientServicePortPrivate();
|
||||
|
||||
static int getConnectionServerNumber();
|
||||
static int getFakeBuddyPoints();
|
||||
static const uint16 getClientServicePortPublic();
|
||||
|
||||
static const char * getPublicBindAddress();
|
||||
static const char *getClusterName();
|
||||
|
||||
static bool getDisableWorldSnapshot();
|
||||
|
||||
static const uint16 getGameServicePort();
|
||||
|
||||
static const int getMaxClients();
|
||||
|
||||
static const uint16 getPingPort();
|
||||
|
||||
static const bool getSpamLimitEnabled();
|
||||
|
||||
static const unsigned int getSpamLimitResetTimeMs();
|
||||
|
||||
static const unsigned int getSpamLimitResetScaleFactor();
|
||||
|
||||
static const unsigned int getSpamLimitBytesPerSec();
|
||||
|
||||
static const unsigned int getSpamLimitPacketsPerSec();
|
||||
|
||||
static const bool getStartPublicServer();
|
||||
|
||||
static const char *getChatServiceBindInterface();
|
||||
|
||||
static const char *getCustomerServiceBindInterface();
|
||||
|
||||
static const char *getGameServiceBindInterface();
|
||||
|
||||
static const bool getCompressClientNetworkTraffic();
|
||||
|
||||
static void install();
|
||||
|
||||
static void remove();
|
||||
|
||||
static const uint getCrashRecoveryTimeout();
|
||||
|
||||
static bool getShouldSleep();
|
||||
|
||||
static const int getClientMaxOutstandingPackets();
|
||||
|
||||
static const int getClientMaxRawPacketSize();
|
||||
|
||||
static const int getClientMaxConnections();
|
||||
|
||||
static const int getClientFragmentSize();
|
||||
|
||||
static const int getClientMaxDataHoldTime();
|
||||
|
||||
static const int getClientHashTableSize();
|
||||
|
||||
static const int getLagReportThreshold();
|
||||
|
||||
static bool getValidateStationKey();
|
||||
|
||||
static const char *getSessionServers();
|
||||
|
||||
static const int getSessionType();
|
||||
|
||||
static bool getDisableSessionLogout();
|
||||
|
||||
static bool getSessionRecordPlayTime();
|
||||
|
||||
static bool getDisconnectOnInactive();
|
||||
|
||||
static bool getDisconnectFreeTrialOnInactive();
|
||||
|
||||
static const char *getAdminAccountDataTable(void);
|
||||
|
||||
static int getNumberOfSessionServers();
|
||||
|
||||
static char const *getSessionServer(int index);
|
||||
|
||||
static float getTimeBetweenSessionUpdates();
|
||||
|
||||
static const uint32 getDefaultGameFeatures();
|
||||
|
||||
static const uint32 getDefaultSubscriptionFeatures();
|
||||
|
||||
static uint32 getRequiredSubscriptionBits();
|
||||
|
||||
static uint32 getRequiredGameBits();
|
||||
|
||||
static bool getSetJtlRetailIfBetaIsSet();
|
||||
|
||||
static bool getSetEpisode3RetailIfBetaIsSet();
|
||||
|
||||
static bool getSetTrialsOfObiwanRetailIfBetaIsSet();
|
||||
|
||||
static int getDisabledFeatureBits();
|
||||
|
||||
static bool getValidateClientVersion();
|
||||
|
||||
static int getConnectionServerNumber();
|
||||
|
||||
static int getFakeBuddyPoints();
|
||||
|
||||
static const char *getPublicBindAddress();
|
||||
|
||||
static int getMaxConnectionsPerIP();
|
||||
|
||||
static int getMaxConnectionsPerIP();
|
||||
private:
|
||||
static Data * data;
|
||||
static Data *data;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline bool ConfigConnectionServer::getShouldSleep()
|
||||
{
|
||||
return data->shouldSleep;
|
||||
inline const char *ConfigConnectionServer::getSessionURL() {
|
||||
return data->sessionURL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const bool ConfigConnectionServer::getCompressClientNetworkTraffic()
|
||||
{
|
||||
return data->compressClientNetworkTraffic;
|
||||
inline bool ConfigConnectionServer::getShouldSleep() {
|
||||
return data->shouldSleep;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const char * ConfigConnectionServer::getCentralServerAddress ()
|
||||
{
|
||||
return data->centralServerAddress;
|
||||
inline const bool ConfigConnectionServer::getCompressClientNetworkTraffic() {
|
||||
return data->compressClientNetworkTraffic;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const uint16 ConfigConnectionServer::getCentralServerPort ()
|
||||
{
|
||||
return static_cast<const uint16>(data->centralServerPort);
|
||||
inline const char *ConfigConnectionServer::getCentralServerAddress() {
|
||||
return data->centralServerAddress;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const char* ConfigConnectionServer::getClientServiceBindInterface()
|
||||
{
|
||||
return data->clientServiceBindInterface;
|
||||
inline const uint16 ConfigConnectionServer::getCentralServerPort() {
|
||||
return static_cast<const uint16>(data->centralServerPort);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const int ConfigConnectionServer::getClientOverflowLimit()
|
||||
{
|
||||
return data->clientOverflowLimit;
|
||||
inline const char *ConfigConnectionServer::getClientServiceBindInterface() {
|
||||
return data->clientServiceBindInterface;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const uint16 ConfigConnectionServer::getClientServicePortPrivate()
|
||||
{
|
||||
return static_cast<const uint16>(data->clientServicePortPrivate);
|
||||
inline const int ConfigConnectionServer::getClientOverflowLimit() {
|
||||
return data->clientOverflowLimit;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const uint16 ConfigConnectionServer::getClientServicePortPublic()
|
||||
{
|
||||
return static_cast<const uint16>(data->clientServicePortPublic);
|
||||
inline const uint16 ConfigConnectionServer::getClientServicePortPrivate() {
|
||||
return static_cast<const uint16>(data->clientServicePortPrivate);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const char * ConfigConnectionServer::getClusterName()
|
||||
{
|
||||
return data->clusterName;
|
||||
inline const uint16 ConfigConnectionServer::getClientServicePortPublic() {
|
||||
return static_cast<const uint16>(data->clientServicePortPublic);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline bool ConfigConnectionServer::getDisableWorldSnapshot()
|
||||
{
|
||||
return data->disableWorldSnapshot;
|
||||
inline const char *ConfigConnectionServer::getClusterName() {
|
||||
return data->clusterName;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const uint16 ConfigConnectionServer::getGameServicePort()
|
||||
{
|
||||
return static_cast<const uint16>(data->gameServicePort);
|
||||
inline bool ConfigConnectionServer::getDisableWorldSnapshot() {
|
||||
return data->disableWorldSnapshot;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const int ConfigConnectionServer::getMaxClients()
|
||||
{
|
||||
return data->maxClients;
|
||||
inline const uint16 ConfigConnectionServer::getGameServicePort() {
|
||||
return static_cast<const uint16>(data->gameServicePort);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const uint16 ConfigConnectionServer::getPingPort ()
|
||||
{
|
||||
return static_cast<const uint16>(data->pingPort);
|
||||
inline const int ConfigConnectionServer::getMaxClients() {
|
||||
return data->maxClients;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const bool ConfigConnectionServer::getSpamLimitEnabled ()
|
||||
{
|
||||
return data->spamLimitEnabled;
|
||||
inline const uint16 ConfigConnectionServer::getPingPort() {
|
||||
return static_cast<const uint16>(data->pingPort);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const unsigned int ConfigConnectionServer::getSpamLimitResetTimeMs ()
|
||||
{
|
||||
return static_cast<const unsigned int>(data->spamLimitResetTimeMs);
|
||||
inline const bool ConfigConnectionServer::getSpamLimitEnabled() {
|
||||
return data->spamLimitEnabled;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const unsigned int ConfigConnectionServer::getSpamLimitResetScaleFactor ()
|
||||
{
|
||||
return static_cast<const unsigned int>(data->spamLimitResetScaleFactor);
|
||||
inline const unsigned int ConfigConnectionServer::getSpamLimitResetTimeMs() {
|
||||
return static_cast<const unsigned int>(data->spamLimitResetTimeMs);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const unsigned int ConfigConnectionServer::getSpamLimitBytesPerSec ()
|
||||
{
|
||||
return static_cast<const unsigned int>(data->spamLimitBytesPerSec);
|
||||
inline const unsigned int ConfigConnectionServer::getSpamLimitResetScaleFactor() {
|
||||
return static_cast<const unsigned int>(data->spamLimitResetScaleFactor);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const unsigned int ConfigConnectionServer::getSpamLimitPacketsPerSec ()
|
||||
{
|
||||
return static_cast<const unsigned int>(data->spamLimitPacketsPerSec);
|
||||
inline const unsigned int ConfigConnectionServer::getSpamLimitBytesPerSec() {
|
||||
return static_cast<const unsigned int>(data->spamLimitBytesPerSec);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const bool ConfigConnectionServer::getStartPublicServer()
|
||||
{
|
||||
return data->startPublicServer;
|
||||
inline const unsigned int ConfigConnectionServer::getSpamLimitPacketsPerSec() {
|
||||
return static_cast<const unsigned int>(data->spamLimitPacketsPerSec);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const char * ConfigConnectionServer::getChatServiceBindInterface()
|
||||
{
|
||||
return data->chatServiceBindInterface;
|
||||
inline const bool ConfigConnectionServer::getStartPublicServer() {
|
||||
return data->startPublicServer;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const char * ConfigConnectionServer::getCustomerServiceBindInterface()
|
||||
{
|
||||
return data->customerServiceBindInterface;
|
||||
inline const char *ConfigConnectionServer::getChatServiceBindInterface() {
|
||||
return data->chatServiceBindInterface;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const char * ConfigConnectionServer::getGameServiceBindInterface()
|
||||
{
|
||||
return data->gameServiceBindInterface;
|
||||
inline const char *ConfigConnectionServer::getCustomerServiceBindInterface() {
|
||||
return data->customerServiceBindInterface;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const char *ConfigConnectionServer::getGameServiceBindInterface() {
|
||||
return data->gameServiceBindInterface;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const uint ConfigConnectionServer::getCrashRecoveryTimeout()
|
||||
{
|
||||
return static_cast<uint>(data->crashRecoveryTimeout);
|
||||
inline const uint ConfigConnectionServer::getCrashRecoveryTimeout() {
|
||||
return static_cast<uint>(data->crashRecoveryTimeout);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const int ConfigConnectionServer::getClientMaxOutstandingPackets()
|
||||
{
|
||||
return data->clientMaxOutstandingPackets;
|
||||
inline const int ConfigConnectionServer::getClientMaxOutstandingPackets() {
|
||||
return data->clientMaxOutstandingPackets;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const int ConfigConnectionServer::getClientMaxRawPacketSize()
|
||||
{
|
||||
return data->clientMaxRawPacketSize;
|
||||
inline const int ConfigConnectionServer::getClientMaxRawPacketSize() {
|
||||
return data->clientMaxRawPacketSize;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const int ConfigConnectionServer::getClientMaxConnections()
|
||||
{
|
||||
return data->clientMaxConnections;
|
||||
inline const int ConfigConnectionServer::getClientMaxConnections() {
|
||||
return data->clientMaxConnections;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const int ConfigConnectionServer::getClientFragmentSize()
|
||||
{
|
||||
return data->clientFragmentSize;
|
||||
inline const int ConfigConnectionServer::getClientFragmentSize() {
|
||||
return data->clientFragmentSize;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const int ConfigConnectionServer::getClientMaxDataHoldTime()
|
||||
{
|
||||
return data->clientMaxDataHoldTime;
|
||||
inline const int ConfigConnectionServer::getClientMaxDataHoldTime() {
|
||||
return data->clientMaxDataHoldTime;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const int ConfigConnectionServer::getClientHashTableSize()
|
||||
{
|
||||
return data->clientHashTableSize;
|
||||
inline const int ConfigConnectionServer::getClientHashTableSize() {
|
||||
return data->clientHashTableSize;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline const int ConfigConnectionServer::getLagReportThreshold()
|
||||
{
|
||||
return data->lagReportThreshold;
|
||||
inline const int ConfigConnectionServer::getLagReportThreshold() {
|
||||
return data->lagReportThreshold;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
inline bool ConfigConnectionServer::getValidateStationKey()
|
||||
{
|
||||
return data->validateStationKey;
|
||||
inline bool ConfigConnectionServer::getValidateStationKey() {
|
||||
return data->validateStationKey;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
inline const char * ConfigConnectionServer::getSessionServers()
|
||||
{
|
||||
return data->sessionServers;
|
||||
inline const char *ConfigConnectionServer::getSessionServers() {
|
||||
return data->sessionServers;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
inline const int ConfigConnectionServer::getSessionType()
|
||||
{
|
||||
return data->sessionType;
|
||||
inline const int ConfigConnectionServer::getSessionType() {
|
||||
return data->sessionType;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
inline bool ConfigConnectionServer::getDisableSessionLogout()
|
||||
{
|
||||
return data->disableSessionLogout;
|
||||
inline bool ConfigConnectionServer::getDisableSessionLogout() {
|
||||
return data->disableSessionLogout;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
inline bool ConfigConnectionServer::getSessionRecordPlayTime()
|
||||
{
|
||||
return data->sessionRecordPlayTime;
|
||||
inline bool ConfigConnectionServer::getSessionRecordPlayTime() {
|
||||
return data->sessionRecordPlayTime;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const char * ConfigConnectionServer::getAdminAccountDataTable(void)
|
||||
{
|
||||
return data->adminAccountDataTable;
|
||||
inline const char *ConfigConnectionServer::getAdminAccountDataTable(void) {
|
||||
return data->adminAccountDataTable;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline float ConfigConnectionServer::getTimeBetweenSessionUpdates()
|
||||
{
|
||||
return data->timeBetweenSessionUpdates;
|
||||
inline float ConfigConnectionServer::getTimeBetweenSessionUpdates() {
|
||||
return data->timeBetweenSessionUpdates;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
inline uint32 ConfigConnectionServer::getRequiredSubscriptionBits()
|
||||
{
|
||||
return static_cast<uint32>(data->requiredSubscriptionBits);
|
||||
inline uint32 ConfigConnectionServer::getRequiredSubscriptionBits() {
|
||||
return static_cast<uint32>(data->requiredSubscriptionBits);
|
||||
}
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
|
||||
inline uint32 ConfigConnectionServer::getRequiredGameBits()
|
||||
{
|
||||
return static_cast<uint32>(data->requiredGameBits);
|
||||
inline uint32 ConfigConnectionServer::getRequiredGameBits() {
|
||||
return static_cast<uint32>(data->requiredGameBits);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
|
||||
inline const uint32 ConfigConnectionServer::getDefaultGameFeatures()
|
||||
{
|
||||
return static_cast<uint32>(data->defaultGameFeatures);
|
||||
inline const uint32 ConfigConnectionServer::getDefaultGameFeatures() {
|
||||
return static_cast<uint32>(data->defaultGameFeatures);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline const uint32 ConfigConnectionServer::getDefaultSubscriptionFeatures()
|
||||
{
|
||||
return static_cast<uint32>(data->defaultSubscriptionFeatures);
|
||||
inline const uint32 ConfigConnectionServer::getDefaultSubscriptionFeatures() {
|
||||
return static_cast<uint32>(data->defaultSubscriptionFeatures);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
inline bool ConfigConnectionServer::getSetJtlRetailIfBetaIsSet()
|
||||
{
|
||||
return data->setJtlRetailIfBetaIsSet;
|
||||
inline bool ConfigConnectionServer::getSetJtlRetailIfBetaIsSet() {
|
||||
return data->setJtlRetailIfBetaIsSet;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
inline bool ConfigConnectionServer::getSetEpisode3RetailIfBetaIsSet()
|
||||
{
|
||||
return data->setEpisode3RetailIfBetaIsSet;
|
||||
inline bool ConfigConnectionServer::getSetEpisode3RetailIfBetaIsSet() {
|
||||
return data->setEpisode3RetailIfBetaIsSet;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
inline bool ConfigConnectionServer::getSetTrialsOfObiwanRetailIfBetaIsSet()
|
||||
{
|
||||
return data->setTrialsOfObiwanRetailIfBetaIsSet;
|
||||
inline bool ConfigConnectionServer::getSetTrialsOfObiwanRetailIfBetaIsSet() {
|
||||
return data->setTrialsOfObiwanRetailIfBetaIsSet;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
||||
inline bool ConfigConnectionServer::getValidateClientVersion()
|
||||
{
|
||||
return data->validateClientVersion;
|
||||
inline bool ConfigConnectionServer::getValidateClientVersion() {
|
||||
return data->validateClientVersion;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline int ConfigConnectionServer::getConnectionServerNumber()
|
||||
{
|
||||
return data->connectionServerNumber;
|
||||
inline int ConfigConnectionServer::getConnectionServerNumber() {
|
||||
return data->connectionServerNumber;
|
||||
}
|
||||
|
||||
|
||||
inline int ConfigConnectionServer::getMaxConnectionsPerIP()
|
||||
{
|
||||
return data->maxConnectionsPerIP;
|
||||
inline int ConfigConnectionServer::getMaxConnectionsPerIP() {
|
||||
return data->maxConnectionsPerIP;
|
||||
}
|
||||
|
||||
#endif // _ConfigConnectionServer_H
|
||||
|
||||
@@ -98,7 +98,6 @@ ConnectionServer::ConnectionServer() :
|
||||
networkBarrier(0),
|
||||
pingSocket(new UdpSock),
|
||||
m_recoverTime(0),
|
||||
m_sessionApiClient(0),
|
||||
m_pingTrafficNumBytes(0),
|
||||
m_recoveringClientList()
|
||||
{
|
||||
@@ -120,11 +119,6 @@ ConnectionServer::ConnectionServer() :
|
||||
|
||||
Address a("", ConfigConnectionServer::getPingPort());
|
||||
IGNORE_RETURN(pingSocket->bind(a));
|
||||
|
||||
if (ConfigConnectionServer::getValidateStationKey())
|
||||
{
|
||||
installSessionValidation();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -1106,10 +1100,10 @@ void ConnectionServer::update()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_sessionApiClient)
|
||||
/*if (m_sessionApiClient)
|
||||
{
|
||||
m_sessionApiClient->update();
|
||||
}
|
||||
}*/
|
||||
|
||||
static const int ping_throttle_max = 1024;
|
||||
|
||||
@@ -1430,7 +1424,7 @@ CentralConnection * ConnectionServer::getCentralConnection()
|
||||
|
||||
void ConnectionServer::installSessionValidation()
|
||||
{
|
||||
int i = 0;
|
||||
/*int i = 0;
|
||||
std::vector<char const *> sessionServers;
|
||||
int const numberOfSessionServers = ConfigConnectionServer::getNumberOfSessionServers();
|
||||
for (i = 0; i < numberOfSessionServers; ++i)
|
||||
@@ -1445,7 +1439,8 @@ void ConnectionServer::installSessionValidation()
|
||||
|
||||
// if there were none specified, use defaults
|
||||
FATAL(i == 0, ("No session servers specified for session API"));
|
||||
m_sessionApiClient = new SessionApiClient(&sessionServers[0], i);
|
||||
m_sessionApiClient = new SessionApiClient(&sessionServers[0], i);*/
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -1575,14 +1570,14 @@ SessionApiClient* ConnectionServer::getSessionApiClient()
|
||||
{
|
||||
// this is causing crashes when ConnectionServer is shutdown and something calls this function
|
||||
// because instance() returns 0.
|
||||
if (s_connectionServer)
|
||||
{
|
||||
return instance().m_sessionApiClient;
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (s_connectionServer)
|
||||
//{
|
||||
// return instance().m_sessionApiClient;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
return 0;
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -58,12 +58,12 @@ void ClientConnection::onConnectionClosed() {
|
||||
|
||||
LoginServer::getInstance().removeClient(m_clientId);
|
||||
|
||||
if ((ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin()) && !m_isValidated) {
|
||||
/* if ((ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin()) && !m_isValidated) {
|
||||
SessionApiClient *session = LoginServer::getInstance().getSessionApiClient();
|
||||
if (session) {
|
||||
session->dropClient(this);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -167,17 +167,18 @@ void ClientConnection::onReceive(const Archive::ByteStream &message) {
|
||||
// originally was used to validate station API credentials, now uses our custom api
|
||||
void ClientConnection::validateClient(const std::string &id, const std::string &key) {
|
||||
bool authOK = false;
|
||||
StationId suid = atoi(id.c_str());
|
||||
static const std::string authURL(ConfigLoginServer::getExternalAuthUrl());
|
||||
|
||||
std::string uname;
|
||||
std::string parentAccount;
|
||||
std::vector<std::string> childAccounts;
|
||||
std::string sessionID;
|
||||
StationId user_id;
|
||||
StationId parent_id;
|
||||
std::unordered_map<int, std::string> childAccounts;
|
||||
|
||||
if (!authURL.empty()) {
|
||||
// create the object
|
||||
webAPI api(
|
||||
authURL); // TODO: is loginserver single threaded? if so then let's make this static, and clear/reset it each run
|
||||
webAPI api(authURL);
|
||||
|
||||
// add our data
|
||||
api.addJsonData<std::string>("user_name", id);
|
||||
@@ -187,12 +188,16 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
if (api.submit()) {
|
||||
bool status = api.getNullableValue<bool>("status");
|
||||
uname = api.getString("username");
|
||||
sessionID = api.getString("session_key");
|
||||
|
||||
if (status && !uname.empty()) {
|
||||
if (status && !sessionID.empty() && !uname.empty()) {
|
||||
authOK = true;
|
||||
|
||||
parentAccount = api.getString("mainAccount");
|
||||
childAccounts = api.getStringVector("subAccounts");
|
||||
childAccounts = api.getStringMap("subAccounts");
|
||||
|
||||
user_id = static_cast<StationId>(api.getNullableValue<int>("user_id"));
|
||||
parent_id = static_cast<StationId>(api.getNullableValue<int>("parent_id"));
|
||||
} else {
|
||||
std::string msg(api.getString("message"));
|
||||
if (msg.empty()) {
|
||||
@@ -213,55 +218,39 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
}
|
||||
|
||||
if (authOK) {
|
||||
if (suid == 0) {
|
||||
if (uname.length() > MAX_ACCOUNT_NAME_LENGTH)
|
||||
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
REPORT_LOG(true, ("Client connected. Username: %s (%i) \n", uname.c_str(), user_id));
|
||||
|
||||
std::hash<std::string> hasher;
|
||||
suid = hasher(uname.c_str());
|
||||
if (!parentAccount.empty()) {
|
||||
if (parentAccount != uname) {
|
||||
REPORT_LOG(true, ("\t%s's parent is %s (%i) \n", uname.c_str(), parentAccount.c_str(), parent_id));
|
||||
}
|
||||
} else {
|
||||
parentAccount = "(Empty Parent!) " + uname;
|
||||
}
|
||||
|
||||
REPORT_LOG(true, ("Client connected. Username: %s (%lu) \n", uname.c_str(), suid));
|
||||
|
||||
StationId parent = -1;
|
||||
|
||||
if (!parentAccount.empty()) {
|
||||
if (parentAccount.length() > MAX_ACCOUNT_NAME_LENGTH)
|
||||
parentAccount.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
|
||||
std::hash<std::string> hasher;
|
||||
parent = hasher(parentAccount.c_str());
|
||||
|
||||
if (parentAccount != uname) {
|
||||
REPORT_LOG(true, ("\t%s's parent is %s (%lu) \n", uname.c_str(), parentAccount.c_str(), parent));
|
||||
}
|
||||
} else {
|
||||
parentAccount = "(Empty Parent!) "+uname;
|
||||
}
|
||||
|
||||
for (auto i : childAccounts) {
|
||||
std::string child(i);
|
||||
StationId child_id = static_cast<StationId>(i.first);
|
||||
std::string child(i.second);
|
||||
|
||||
if (!child.empty()) {
|
||||
if (child.length() > MAX_ACCOUNT_NAME_LENGTH)
|
||||
child.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
REPORT_LOG((parent_id != child_id),
|
||||
("\tchild of %s (%i) is %s (%i) \n", parentAccount.c_str(), parent_id, child.c_str(), child_id));
|
||||
|
||||
std::hash<std::string> hasher;
|
||||
StationId childID = hasher(child.c_str());
|
||||
|
||||
REPORT_LOG(true, ("\tchild of %s (%lu) is %s (%lu) \n", parentAccount.c_str(), parent, child.c_str(), childID));
|
||||
|
||||
// insert all related accounts, if not already there, into the db
|
||||
DatabaseConnection::getInstance().upsertAccountRelationship(parent, childID);
|
||||
} else {
|
||||
WARNING(true, ("Login API returned empty child account(s)."));
|
||||
}
|
||||
// insert all related accounts, if not already there, into the db
|
||||
if (parent_id != child_id) {
|
||||
DatabaseConnection::getInstance().upsertAccountRelationship(parent_id, child_id);
|
||||
}
|
||||
} else {
|
||||
WARNING(true, ("Login API returned empty child account(s)."));
|
||||
}
|
||||
}
|
||||
|
||||
LOG("LoginClientConnection",
|
||||
("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), uname.c_str()));
|
||||
("validateClient() for stationId (%i) at IP (%s), id (%s)", user_id, getRemoteAddress().c_str(), uname.c_str()));
|
||||
|
||||
LoginServer::getInstance().onValidateClient(suid, uname, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF);
|
||||
m_stationId = user_id;
|
||||
|
||||
LoginServer::getInstance().onValidateClient(m_stationId, uname, this, true, sessionID.c_str(), 0xFFFFFFFF, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,6 @@ LoginServer::LoginServer() :
|
||||
keyServer(0),
|
||||
m_clientMap(),
|
||||
m_clusterList(),
|
||||
m_sessionApiClient(0),
|
||||
m_validatedClientMap(),
|
||||
m_clusterStatusChanged(false),
|
||||
m_soeMonitor(0)
|
||||
@@ -202,11 +201,6 @@ LoginServer::LoginServer() :
|
||||
connectToMessage("FeatureIdTransactionRequest");
|
||||
connectToMessage("FeatureIdTransactionSyncUpdate");
|
||||
keyServer = new KeyServer;
|
||||
|
||||
if (ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin())
|
||||
{
|
||||
installSessionValidation();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -269,7 +263,7 @@ void LoginServer::removeClient(int clientId)
|
||||
|
||||
void LoginServer::installSessionValidation()
|
||||
{
|
||||
int i = 0;
|
||||
/*int i = 0;
|
||||
std::vector<const char* > sessionServers;
|
||||
|
||||
int numberOfSessionServers = ConfigLoginServer::getNumberOfSessionServers();
|
||||
@@ -286,7 +280,9 @@ void LoginServer::installSessionValidation()
|
||||
// if there were none specified, use defaults
|
||||
FATAL(i == 0, ("No session servers specified for session API"));
|
||||
|
||||
m_sessionApiClient = new SessionApiClient(&sessionServers[0], i);
|
||||
m_sessionApiClient = new SessionApiClient(&sessionServers[0], i);*/
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -913,7 +909,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const
|
||||
{
|
||||
if (m_sessionApiClient)
|
||||
{
|
||||
if (consumeAccountFeatureId)
|
||||
/*if (consumeAccountFeatureId)
|
||||
{
|
||||
// request session/Platform to update the account feature id
|
||||
// SessionApiClient will own (and delete) msg
|
||||
@@ -931,7 +927,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const
|
||||
|
||||
DatabaseConnection::getInstance().claimRewards(conn->getClusterId(), msg->getGameServer(), msg->getStationId(), msg->getPlayer(), msg->getRewardEvent(), msg->getConsumeEvent(), msg->getRewardItem(), msg->getConsumeItem(), requiredAccountFeatureId, false, oldFeature.GetConsumeCount(), newFeature.GetConsumeCount());
|
||||
delete msg;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1200,8 +1196,8 @@ void LoginServer::run(void)
|
||||
getInstance().m_clusterStatusChanged = false;
|
||||
}
|
||||
|
||||
if (getInstance().m_sessionApiClient)
|
||||
getInstance().m_sessionApiClient->Process();
|
||||
//if (getInstance().m_sessionApiClient)
|
||||
// getInstance().m_sessionApiClient->Process();
|
||||
|
||||
totalTime += limit; //TODO: make a better way to do this
|
||||
if (!ConfigLoginServer::getDevelopmentMode() && (totalTime > 10000))
|
||||
@@ -1420,10 +1416,13 @@ void LoginServer::onValidateClient(StationId suid, const std::string & username,
|
||||
|
||||
if (ConfigLoginServer::getDoConsumption() || ConfigLoginServer::getDoSessionLogin())
|
||||
{
|
||||
std::string const strSessionKey(sessionKey);
|
||||
size_t sessSize = sizeof(strSessionKey.c_str());
|
||||
|
||||
// pass the sessionkey
|
||||
len = apiSessionIdWidth + sizeof(StationId);
|
||||
memcpy(keyBufferPointer, sessionKey, apiSessionIdWidth);
|
||||
keyBufferPointer += apiSessionIdWidth;
|
||||
len = sessSize + sizeof(StationId);
|
||||
memcpy(keyBufferPointer, sessionKey, sessSize);
|
||||
keyBufferPointer += len;
|
||||
memcpy(keyBufferPointer, &suid, sizeof(StationId));
|
||||
|
||||
// if LoginServer did session login, send the session key back to the client;
|
||||
@@ -1431,7 +1430,6 @@ void LoginServer::onValidateClient(StationId suid, const std::string & username,
|
||||
// where the LoginServer does the session login, it will get it from the LoginServer
|
||||
if (ConfigLoginServer::getDoSessionLogin())
|
||||
{
|
||||
std::string const strSessionKey(sessionKey, apiSessionIdWidth);
|
||||
GenericValueTypeMessage<std::string> const msg("SetSessionKey", strSessionKey);
|
||||
conn->send(msg, true);
|
||||
}
|
||||
|
||||
@@ -120,10 +120,7 @@ void PurgeManager::onGetAccountForPurge(StationId account, int purgePhase)
|
||||
PurgeRecord record(account, static_cast<PurgePhase>(purgePhase));
|
||||
m_purgeRecords.insert(std::make_pair(account,record));
|
||||
|
||||
if (ConfigLoginServer::getValidateStationKey())
|
||||
NON_NULL(LoginServer::getInstance().getSessionApiClient())->checkStatusForPurge(account);
|
||||
else
|
||||
onCheckStatusForPurge(account, false);
|
||||
onCheckStatusForPurge(account, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -189,7 +189,7 @@ void TangibleObject::endNpcConversation()
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING(true,("TangibleObject::endNpcConversation: creature %s has a nullptr m_npcConversation pointer but is a player-controlled object!",
|
||||
DEBUG_WARNING(true,("TangibleObject::endNpcConversation: creature %s has a nullptr m_npcConversation pointer but is a player-controlled object!",
|
||||
getNetworkId().getValueString().c_str()));
|
||||
m_conversations.clear();
|
||||
}
|
||||
|
||||
+1
-3
@@ -103,10 +103,8 @@ public:
|
||||
void setWorkingSkill (const std::string & workingSkill);
|
||||
|
||||
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);
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
|
||||
// ======================================================================
|
||||
|
||||
typedef unsigned long uint32;
|
||||
|
||||
// ======================================================================
|
||||
|
||||
class DebugHelp
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -306,7 +306,7 @@ class apiSubscription
|
||||
unsigned mParentalLimitSeconds;
|
||||
};
|
||||
|
||||
static const int apiSessionIdWidth = 17;
|
||||
static const int apiSessionIdWidth = 45;
|
||||
struct apiSession_v1;
|
||||
class apiSession
|
||||
{
|
||||
|
||||
Vendored
+2604
-770
File diff suppressed because it is too large
Load Diff
+18
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Version: 1.5
|
||||
* Version: 1.6
|
||||
*
|
||||
* This code is just a simple wrapper around nlohmann's wonderful json lib
|
||||
* (https://github.com/nlohmann/json) and libcurl. While originally included directly,
|
||||
@@ -55,13 +55,23 @@ std::string webAPI::getString(const std::string &slot) {
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
std::vector<std::string> webAPI::getStringVector(const std::string &slot) {
|
||||
std::unordered_map<int, std::string> webAPI::getStringMap(const std::string &slot) {
|
||||
std::unordered_map<int, std::string> ret = std::unordered_map<int, std::string>();
|
||||
|
||||
if (!this->responseData.empty() && !slot.empty() && responseData.count(slot) &&
|
||||
!this->responseData[slot].is_null()) {
|
||||
return this->responseData[slot].get<std::vector<std::string>>();
|
||||
}
|
||||
|
||||
nlohmann::json j = this->responseData[slot];
|
||||
|
||||
return std::vector<std::string>();
|
||||
for (nlohmann::json::iterator it = j.begin(); it != j.end(); ++it) {
|
||||
int k = std::stoi(it.key());
|
||||
std::string val = it.value();
|
||||
|
||||
ret.insert({k, val});
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool webAPI::submit(const int &reqType, const int &getPost, const int &respType) {
|
||||
@@ -112,6 +122,8 @@ bool webAPI::fetch(const int &getPost, const int &mimeType) // 0 for json 1 for
|
||||
writeCallback); // place the data into readBuffer using writeCallback
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); // specify readBuffer as the container for data
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
|
||||
switch (getPost) {
|
||||
case HTTP::GET:
|
||||
@@ -182,4 +194,4 @@ bool webAPI::processJSON() {
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Version: 1.5
|
||||
* Version: 1.6
|
||||
*
|
||||
* This code is just a simple wrapper around nlohmann's wonderful json lib
|
||||
* (https://github.com/nlohmann/json) and libcurl. While originally included directly,
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <curl.h>
|
||||
#else
|
||||
|
||||
#include <unordered_map>
|
||||
#include <curl/curl.h>
|
||||
|
||||
#endif
|
||||
@@ -63,7 +64,7 @@ namespace StellaBellum {
|
||||
std::string getString(const std::string &slot);
|
||||
|
||||
// get a vector of strings from a given slot
|
||||
std::vector<std::string> getStringVector(const std::string &slot);
|
||||
std::unordered_map<int, std::string> getStringMap(const std::string &slot);
|
||||
|
||||
// set json key and value for request
|
||||
template<typename T>
|
||||
|
||||
Reference in New Issue
Block a user