mirror of
https://github.com/SWG-Source/src.git
synced 2026-08-28 17:56:29 -04:00
i know this is probably broken but i'll get it working
This commit is contained in:
@@ -98,7 +98,6 @@ ConnectionServer::ConnectionServer() :
|
||||
networkBarrier(0),
|
||||
pingSocket(new UdpSock),
|
||||
m_recoverTime(0),
|
||||
m_sessionApiClient(0),
|
||||
m_pingTrafficNumBytes(0),
|
||||
m_recoveringClientList()
|
||||
{
|
||||
@@ -1106,10 +1105,10 @@ void ConnectionServer::update()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_sessionApiClient)
|
||||
/*if (m_sessionApiClient)
|
||||
{
|
||||
m_sessionApiClient->update();
|
||||
}
|
||||
}*/
|
||||
|
||||
static const int ping_throttle_max = 1024;
|
||||
|
||||
@@ -1430,7 +1429,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 +1444,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 +1575,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;
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "DatabaseConnection.h"
|
||||
#include "ConfigLoginServer.h"
|
||||
#include "SessionApiClient.h"
|
||||
//#include "SessionApiClient.h"
|
||||
#include "sharedLog/Log.h"
|
||||
#include "sharedNetworkMessages/ClientLoginMessages.h"
|
||||
#include "sharedNetworkMessages/DeleteCharacterMessage.h"
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -171,13 +171,14 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
|
||||
std::string uname;
|
||||
std::string parentAccount;
|
||||
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);
|
||||
webAPI api(authURL);
|
||||
|
||||
// add our data
|
||||
api.addJsonData<std::string>("user_name", id);
|
||||
@@ -187,15 +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.getStringMap("subAccounts");
|
||||
|
||||
user_id = static_cast<StationId>(api.getNullableValue<int>("user_id"));
|
||||
parent_id = static_cast<StationId>(api.getNullableValue<int>("parent_id"));
|
||||
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()) {
|
||||
@@ -216,38 +218,39 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
}
|
||||
|
||||
if (authOK && user_id && parent_id) {
|
||||
REPORT_LOG(true, ("Client connected. Username: %s (%i) \n", uname.c_str(), user_id));
|
||||
REPORT_LOG(true, ("Client connected. Username: %s (%i) \n", uname.c_str(), user_id));
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
for (auto i : childAccounts) {
|
||||
StationId child_id = static_cast<StationId>(i.first);
|
||||
std::string child(i.second);
|
||||
StationId child_id = static_cast<StationId>(i.first);
|
||||
std::string child(i.second);
|
||||
|
||||
if (!child.empty()) {
|
||||
REPORT_LOG((parent_id != child_id), ("\tchild of %s (%i) is %s (%i) \n", parentAccount.c_str(), parent_id, child.c_str(), child_id));
|
||||
|
||||
// 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)."));
|
||||
}
|
||||
}
|
||||
if (!child.empty()) {
|
||||
REPORT_LOG((parent_id != child_id),
|
||||
("\tchild of %s (%i) is %s (%i) \n", parentAccount.c_str(), parent_id, child.c_str(), child_id));
|
||||
|
||||
// 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 (%i) at IP (%s), id (%s)", user_id, getRemoteAddress().c_str(), uname.c_str()));
|
||||
|
||||
m_stationId = user_id;
|
||||
m_stationId = user_id;
|
||||
|
||||
LoginServer::getInstance().onValidateClient(m_stationId, uname, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF);
|
||||
LoginServer::getInstance().onValidateClient(m_stationId, uname, this, true, sessionID.c_str(), 0xFFFFFFFF, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "MonAPI2/MonitorAPI.h"
|
||||
#include "PingConnection.h"
|
||||
#include "PurgeManager.h"
|
||||
#include "SessionApiClient.h"
|
||||
//#include "SessionApiClient.h"
|
||||
#include "UnicodeUtils.h"
|
||||
#include "serverKeyShare/KeyServer.h"
|
||||
#include "serverNetworkMessages/AccountFeatureIdRequest.h"
|
||||
@@ -140,7 +140,6 @@ LoginServer::LoginServer() :
|
||||
keyServer(0),
|
||||
m_clientMap(),
|
||||
m_clusterList(),
|
||||
m_sessionApiClient(0),
|
||||
m_validatedClientMap(),
|
||||
m_clusterStatusChanged(false),
|
||||
m_soeMonitor(0)
|
||||
@@ -203,10 +202,10 @@ LoginServer::LoginServer() :
|
||||
connectToMessage("FeatureIdTransactionSyncUpdate");
|
||||
keyServer = new KeyServer;
|
||||
|
||||
if (ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin())
|
||||
/*if (ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin())
|
||||
{
|
||||
installSessionValidation();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -269,7 +268,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 +285,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;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -334,7 +335,8 @@ const KeyShare::Key & LoginServer::getCurrentKey(void) const
|
||||
|
||||
SessionApiClient * LoginServer::getSessionApiClient()
|
||||
{
|
||||
return m_sessionApiClient;
|
||||
return true;
|
||||
//return m_sessionApiClient;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -913,7 +915,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 +933,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 +1202,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))
|
||||
|
||||
Reference in New Issue
Block a user