mirror of
https://github.com/SWG-Source/src.git
synced 2026-08-02 02:15:58 -04:00
Merge branch 'testing' into cmake-profile-build
This commit is contained in:
@@ -59,23 +59,23 @@ ClientConnection::~ClientConnection()
|
||||
void ClientConnection::onConnectionClosed()
|
||||
{
|
||||
// client has disconnected
|
||||
if (m_clientId)
|
||||
if (m_stationId)
|
||||
{
|
||||
if (m_stationId)
|
||||
{
|
||||
DEBUG_REPORT_LOG(true, ("Client %lu disconnected\n", m_stationId));
|
||||
LOG("LoginClientConnection",
|
||||
("onConnectionClosed() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
|
||||
LoginServer::getInstance().removeClient(m_clientId);
|
||||
DEBUG_REPORT_LOG(true, ("Client %lu disconnected\n", m_stationId));
|
||||
LOG("LoginClientConnection", ("onConnectionClosed() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
|
||||
if (!m_isValidated) {
|
||||
LoginServer::getInstance().removeClient(m_clientId);
|
||||
|
||||
if ((ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin()) && !m_isValidated)
|
||||
{
|
||||
SessionApiClient *session = LoginServer::getInstance().getSessionApiClient();
|
||||
if (session)
|
||||
{
|
||||
session->dropClient(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -194,7 +194,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string
|
||||
if (!authURL.empty())
|
||||
{
|
||||
// create the object
|
||||
webAPI api(authURL);
|
||||
webAPI api(authURL); // TODO: is loginserver single threaded? if so then let's make this static, and clear/reset it each run
|
||||
|
||||
// add our data
|
||||
api.addJsonData<std::string>("user_name", id);
|
||||
@@ -239,7 +239,8 @@ void ClientConnection::validateClient(const std::string & id, const std::string
|
||||
{
|
||||
if (suid == 0)
|
||||
{
|
||||
if (uname.length() > MAX_ACCOUNT_NAME_LENGTH) {
|
||||
if (uname.length() > MAX_ACCOUNT_NAME_LENGTH)
|
||||
{
|
||||
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
@@ -288,6 +289,8 @@ void ClientConnection::onCharacterDeletedFromCluster(const NetworkId & character
|
||||
if(f != m_charactersPendingDeletion.end())
|
||||
{
|
||||
m_charactersPendingDeletion.erase(f);
|
||||
|
||||
// TODO: send api request and decrement # characters on this account/subaccount
|
||||
}
|
||||
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_OK);
|
||||
|
||||
@@ -94,7 +94,7 @@ void ConfigLoginServer::install(void)
|
||||
KEY_BOOL (developmentMode, true);
|
||||
KEY_INT (databaseThreads, 1);
|
||||
KEY_BOOL (compressClientNetworkTraffic, true);
|
||||
KEY_INT (metricsListenerPort, 2201);
|
||||
KEY_INT (metricsListenerPort, 0); // defaults to 2201 but we don't use it
|
||||
KEY_FLOAT (defaultDBQueueUpdateTimeLimit, 0.25f);
|
||||
KEY_INT (disconnectSleepTime, 30000);
|
||||
KEY_INT (clusterGroup,1);
|
||||
|
||||
@@ -14,7 +14,11 @@
|
||||
#include "ConsoleManager.h"
|
||||
#include "CSToolConnection.h"
|
||||
#include "DatabaseConnection.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include "LoginServerRemoteDebugSetup.h"
|
||||
#endif
|
||||
|
||||
#include "MonAPI2/MonitorAPI.h"
|
||||
#include "PingConnection.h"
|
||||
#include "PurgeManager.h"
|
||||
@@ -160,7 +164,6 @@ LoginServer::LoginServer() :
|
||||
if (ConfigLoginServer::getDevelopmentMode())
|
||||
{
|
||||
setup.port = ConfigLoginServer::getCentralServicePort();
|
||||
//setup.maxConnections = 1000;
|
||||
m_centralService = new Service(ConnectionAllocator<CentralServerConnection>(), setup);
|
||||
}
|
||||
|
||||
@@ -219,6 +222,7 @@ int LoginServer::addClient(ClientConnection & client)
|
||||
{
|
||||
DEBUG_FATAL(client.getIsValidated(), ("Tried to add an already validated client?!"));
|
||||
//Perhaps add a debug only check to make sure a client connection isn't in twice...I'm not sure how that could happen.
|
||||
|
||||
static int nextClientId = 0;
|
||||
int tmp = ++nextClientId;
|
||||
m_clientMap[tmp] = &client;
|
||||
@@ -250,21 +254,14 @@ ClientConnection* LoginServer::getUnvalidatedClient(int clientId)
|
||||
|
||||
void LoginServer::removeClient(int clientId)
|
||||
{
|
||||
if (clientId) // yeah why bother if it's 0 or null? i realize 0 is a valid int but since previously the warning below fired if it was 0....yeah, no
|
||||
std::map<int, ClientConnection*>::iterator i = m_clientMap.find(clientId);
|
||||
if (i != m_clientMap.end())
|
||||
{
|
||||
std::map<int, ClientConnection*>::iterator i = m_clientMap.find(clientId);
|
||||
if (i != m_clientMap.end())
|
||||
if (i->second->getIsValidated())
|
||||
{
|
||||
if (i->second->getIsValidated())
|
||||
{
|
||||
IGNORE_RETURN(m_validatedClientMap.erase(i->second->getStationId()));
|
||||
}
|
||||
IGNORE_RETURN(m_clientMap.erase(clientId));
|
||||
IGNORE_RETURN(m_validatedClientMap.erase(i->second->getStationId()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WARNING_STRICT_FATAL(true, ("Tried to remove a client with client id == 0"));
|
||||
IGNORE_RETURN(m_clientMap.erase(clientId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -903,6 +900,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const
|
||||
if (conn)
|
||||
{
|
||||
// current restriction is that once per account event or item cannot require a "consuming" account feature id
|
||||
// TODO: looks like this is where vet rewards are consumed...the one per account thing, here - session auth may be enough?
|
||||
uint32 const requiredAccountFeatureId = msg->getAccountFeatureId();
|
||||
bool const consumeAccountFeatureId = msg->getConsumeAccountFeatureId();
|
||||
if ((msg->getConsumeEvent() || msg->getConsumeItem()) && (requiredAccountFeatureId > 0) && consumeAccountFeatureId)
|
||||
@@ -1078,25 +1076,7 @@ void LoginServer::validateAccount(const StationId& stationId, uint32 clusterId,
|
||||
// Check cluster npe user limit
|
||||
if (cle->m_numTutorialPlayers > cle->m_onlineTutorialLimit)
|
||||
{
|
||||
canCreateRegular = false;
|
||||
canCreateJedi = false;
|
||||
}
|
||||
|
||||
// limit login/character creation based on subscription feature bits
|
||||
if (((subscriptionBits & ClientSubscriptionFeature::FreeTrial) != 0)
|
||||
&& ((subscriptionBits & ClientSubscriptionFeature::Base) == 0))
|
||||
{
|
||||
// Check cluster free trial user limit
|
||||
if (cle->m_numFreeTrialPlayers > cle->m_onlineFreeTrialLimit)
|
||||
{
|
||||
canLogin = false;
|
||||
}
|
||||
// Check cluster free trial character creation
|
||||
if (!cle->m_freeTrialCanCreateChar)
|
||||
{
|
||||
canCreateRegular = false;
|
||||
canCreateJedi = false;
|
||||
}
|
||||
canLogin = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1159,7 +1139,11 @@ void LoginServer::validateAccountForTransfer(const TransferRequestMoveValidation
|
||||
void LoginServer::run(void)
|
||||
{
|
||||
NetworkHandler::install();
|
||||
|
||||
#ifdef _DEBUG
|
||||
LoginServerRemoteDebugSetup::install();
|
||||
#endif
|
||||
|
||||
DatabaseConnection::getInstance().connect();
|
||||
DatabaseConnection::getInstance().requestClusterList();
|
||||
SetupSharedLog::install("LoginServer");
|
||||
@@ -1172,21 +1156,26 @@ void LoginServer::run(void)
|
||||
unsigned long totalTime = 0;
|
||||
|
||||
// load authentication data and bind the monitor to the port
|
||||
CMonitorAPI * mon = new CMonitorAPI("metricsAuthentication.cfg", ConfigLoginServer::getMetricsListenerPort());
|
||||
getInstance().m_soeMonitor = mon;
|
||||
const char *masterChannel = "Population";
|
||||
mon->add(masterChannel, WORLD_COUNT_CHANNEL);
|
||||
std::string host = NetworkHandler::getHostName().c_str();
|
||||
size_t dotPos = host.find(".");
|
||||
if (dotPos != host.npos)
|
||||
{
|
||||
host = host.substr(0, dotPos - 1);
|
||||
}
|
||||
char tmpBuf[1024];
|
||||
IGNORE_RETURN(snprintf(tmpBuf, sizeof(tmpBuf), "LoginServer version %s on %s", ApplicationVersion::getInternalVersion(), host.c_str()));
|
||||
mon->setDescription(WORLD_COUNT_CHANNEL, tmpBuf);
|
||||
const int port = ConfigLoginServer::getMetricsListenerPort();
|
||||
CMonitorAPI *mon = nullptr;
|
||||
|
||||
mon->add("Galaxies", CLUSTER_COUNT_CHANNEL);
|
||||
if (port) {
|
||||
mon = new CMonitorAPI("metricsAuthentication.cfg", ConfigLoginServer::getMetricsListenerPort());
|
||||
getInstance().m_soeMonitor = mon;
|
||||
const char *masterChannel = "Population";
|
||||
mon->add(masterChannel, WORLD_COUNT_CHANNEL);
|
||||
std::string host = NetworkHandler::getHostName().c_str();
|
||||
size_t dotPos = host.find(".");
|
||||
if (dotPos != host.npos) {
|
||||
host = host.substr(0, dotPos - 1);
|
||||
}
|
||||
char tmpBuf[1024];
|
||||
IGNORE_RETURN(snprintf(tmpBuf, sizeof(tmpBuf), "LoginServer version %s on %s", ApplicationVersion::getInternalVersion(), host
|
||||
.c_str()));
|
||||
mon->setDescription(WORLD_COUNT_CHANNEL, tmpBuf);
|
||||
|
||||
mon->add("Galaxies", CLUSTER_COUNT_CHANNEL);
|
||||
}
|
||||
|
||||
while (!getInstance().done)
|
||||
{
|
||||
@@ -1224,23 +1213,27 @@ void LoginServer::run(void)
|
||||
|
||||
NetworkHandler::clearBytesThisFrame();
|
||||
|
||||
mon->set(WORLD_COUNT_CHANNEL, static_cast<int>(getInstance().m_clientMap.size()));
|
||||
int count = 0;
|
||||
ClusterListType::const_iterator i;
|
||||
for (i = getInstance().m_clusterList.begin(); i != getInstance().m_clusterList.end(); ++i)
|
||||
{
|
||||
if ((*i)->m_connected)
|
||||
++count;
|
||||
if (port) {
|
||||
mon->set(WORLD_COUNT_CHANNEL, static_cast<int>(getInstance().m_clientMap.size()));
|
||||
int count = 0;
|
||||
ClusterListType::const_iterator i;
|
||||
for (i = getInstance().m_clusterList.begin(); i != getInstance().m_clusterList.end(); ++i) {
|
||||
if ((*i)->m_connected)
|
||||
++count;
|
||||
}
|
||||
mon->set(CLUSTER_COUNT_CHANNEL, count);
|
||||
mon->Update();
|
||||
}
|
||||
mon->set(CLUSTER_COUNT_CHANNEL, count);
|
||||
mon->Update();
|
||||
}
|
||||
|
||||
NetworkHandler::update();
|
||||
|
||||
ConsoleManager::remove();
|
||||
DatabaseConnection::getInstance().disconnect();
|
||||
|
||||
#ifdef _DEBUG
|
||||
LoginServerRemoteDebugSetup::remove();
|
||||
#endif
|
||||
|
||||
SetupSharedLog::remove();
|
||||
NetworkHandler::remove();
|
||||
|
||||
+1
-1
@@ -1022,7 +1022,7 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e)
|
||||
{
|
||||
if (e->mBuffer[0] == 0 && e->mBuffer[1] == UdpConnection::cUdpPacketPortAlive)
|
||||
return; // port-alive packets are not supposed to reach the destination machine, but on the odd chance they do, pretend like they never existed
|
||||
|
||||
|
||||
UdpConnection *con = AddressGetConnection(e->mIp, e->mPort);
|
||||
|
||||
if (con == nullptr)
|
||||
|
||||
+1
-1
@@ -1078,7 +1078,7 @@ class UdpConnection : public PriorityQueueMember, public AddressHashTableMember,
|
||||
, cDisconnectReasonNewConnectionAttempt, cDisconnectReasonConnectionRefused
|
||||
, cDisconnectReasonMutualConnectError, cDisconnectReasonConnectingToSelf
|
||||
, cDisconnectReasonReliableOverflow
|
||||
, cDisconnectReasonCount, cDisconnectReasonDosAttack };
|
||||
, cDisconnectReasonDosAttack, cDisconnectReasonCount };
|
||||
|
||||
// standard AddRef/Release scheme
|
||||
void AddRef();
|
||||
|
||||
Reference in New Issue
Block a user