mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-01-17 00:04:52 -05:00
autoformat
This commit is contained in:
@@ -301,9 +301,9 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg &msg) {
|
||||
bool cont = false;
|
||||
StationId apiSuid = 0;
|
||||
const std::string clientIP = getRemoteAddress();
|
||||
const std::string sess = sessionId;
|
||||
const std::string sess = sessionId;
|
||||
|
||||
webAPI api(sessURL);
|
||||
webAPI api(sessURL);
|
||||
|
||||
// add our data
|
||||
api.addJsonData<std::string>("session_key", sess);
|
||||
@@ -317,13 +317,13 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg &msg) {
|
||||
int expired = api.getNullableValue<int>("expired");
|
||||
std::string apiUser = api.getString("user_name");
|
||||
std::string apiIP = api.getString("ip");
|
||||
|
||||
if (apiIP == clientIP && expired == 0) {
|
||||
|
||||
if (apiIP == clientIP && expired == 0) {
|
||||
m_suid = apiSuid;
|
||||
cont = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!cont) {
|
||||
LOG("ClientDisconnect", ("SUID %d (%d) passed a bad token to the connections erver. Disconnecting.", m_suid, apiSuid));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,18 +27,10 @@ using namespace StellaBellum;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
ClientConnection::ClientConnection(UdpConnectionMT *u, TcpClient *t) :
|
||||
ServerConnection(u, t),
|
||||
m_clientId(0),
|
||||
m_isValidated(false),
|
||||
m_isSecure(false),
|
||||
m_adminLevel(-1),
|
||||
m_stationId(0),
|
||||
m_requestedAdminSuid(0),
|
||||
m_gameBits(0),
|
||||
m_subscriptionBits(0),
|
||||
m_waitingForCharacterLoginDeletion(false),
|
||||
m_waitingForCharacterClusterDeletion(false) {
|
||||
ClientConnection::ClientConnection(UdpConnectionMT *u, TcpClient *t)
|
||||
: ServerConnection(u, t), m_clientId(0), m_isValidated(false), m_isSecure(false), m_adminLevel(-1),
|
||||
m_stationId(0), m_requestedAdminSuid(0), m_gameBits(0), m_subscriptionBits(0),
|
||||
m_waitingForCharacterLoginDeletion(false), m_waitingForCharacterClusterDeletion(false) {
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -52,18 +44,17 @@ void ClientConnection::onConnectionClosed() {
|
||||
// client has disconnected
|
||||
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()));
|
||||
LOG("LoginClientConnection", ("onConnectionClosed() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
|
||||
LoginServer::getInstance().removeClient(m_clientId);
|
||||
|
||||
/* if ((ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin()) && !m_isValidated) {
|
||||
SessionApiClient *session = LoginServer::getInstance().getSessionApiClient();
|
||||
if (session) {
|
||||
session->dropClient(this);
|
||||
}
|
||||
}*/
|
||||
/* if ((ConfigLoginServer::getValidateStationKey() || ConfigLoginServer::getDoSessionLogin()) && !m_isValidated) {
|
||||
SessionApiClient *session = LoginServer::getInstance().getSessionApiClient();
|
||||
if (session) {
|
||||
session->dropClient(this);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@@ -73,8 +64,7 @@ void ClientConnection::onConnectionOpened() {
|
||||
m_clientId = LoginServer::getInstance().addClient(*this);
|
||||
setOverflowLimit(ConfigLoginServer::getClientOverflowLimit());
|
||||
|
||||
LOG("LoginClientConnection",
|
||||
("onConnectionOpened() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
|
||||
LOG("LoginClientConnection", ("onConnectionOpened() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -100,8 +90,7 @@ void ClientConnection::onReceive(const Archive::ByteStream &message) {
|
||||
// send the client the server "now" Epoch time so that the
|
||||
// client has an idea of how much difference there is between
|
||||
// the client's Epoch time and the server Epoch time
|
||||
GenericValueTypeMessage<int32> const serverNowEpochTime(
|
||||
"ServerNowEpochTime", static_cast<int32>(::time(nullptr)));
|
||||
GenericValueTypeMessage <int32> const serverNowEpochTime("ServerNowEpochTime", static_cast<int32>(::time(nullptr)));
|
||||
send(serverNowEpochTime, true);
|
||||
|
||||
LoginClientId id(ri);
|
||||
@@ -135,16 +124,13 @@ void ClientConnection::onReceive(const Archive::ByteStream &message) {
|
||||
}
|
||||
case constcrc("DeleteCharacterMessage") : {
|
||||
DeleteCharacterMessage msg(ri);
|
||||
std::vector<NetworkId>::const_iterator f = std::find(m_charactersPendingDeletion.begin(),
|
||||
m_charactersPendingDeletion.end(),
|
||||
msg.getCharacterId());
|
||||
std::vector<NetworkId>::const_iterator f = std::find(m_charactersPendingDeletion.begin(), m_charactersPendingDeletion.end(), msg.getCharacterId());
|
||||
if ((m_waitingForCharacterLoginDeletion || m_waitingForCharacterClusterDeletion) &&
|
||||
f != m_charactersPendingDeletion.end()) {
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_ALREADY_IN_PROGRESS);
|
||||
send(reply, true);
|
||||
} else {
|
||||
if (LoginServer::getInstance().deleteCharacter(msg.getClusterId(), msg.getCharacterId(),
|
||||
getStationId())) {
|
||||
if (LoginServer::getInstance().deleteCharacter(msg.getClusterId(), msg.getCharacterId(), getStationId())) {
|
||||
m_waitingForCharacterLoginDeletion = true;
|
||||
m_waitingForCharacterClusterDeletion = true;
|
||||
m_charactersPendingDeletion.push_back(msg.getCharacterId());
|
||||
@@ -156,8 +142,7 @@ void ClientConnection::onReceive(const Archive::ByteStream &message) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const Archive::ReadException &readException) {
|
||||
} catch (const Archive::ReadException &readException) {
|
||||
WARNING(true, ("Archive read error (%s) on message from client. Disconnecting client.", readException.what()));
|
||||
disconnect();
|
||||
}
|
||||
@@ -233,8 +218,8 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
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));
|
||||
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) {
|
||||
@@ -245,8 +230,7 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
}
|
||||
}
|
||||
|
||||
LOG("LoginClientConnection",
|
||||
("validateClient() for stationId (%i) at IP (%s), id (%s)", user_id, getRemoteAddress().c_str(), uname.c_str()));
|
||||
LOG("LoginClientConnection", ("validateClient() for stationId (%i) at IP (%s), id (%s)", user_id, getRemoteAddress().c_str(), uname.c_str()));
|
||||
|
||||
m_stationId = user_id;
|
||||
|
||||
@@ -264,16 +248,14 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
|
||||
void ClientConnection::onCharacterDeletedFromLoginDatabase(const NetworkId &characterId) {
|
||||
m_waitingForCharacterLoginDeletion = false;
|
||||
if (!m_waitingForCharacterClusterDeletion) {
|
||||
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(),
|
||||
m_charactersPendingDeletion.end(), characterId);
|
||||
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(), m_charactersPendingDeletion.end(), characterId);
|
||||
if (f != m_charactersPendingDeletion.end()) {
|
||||
m_charactersPendingDeletion.erase(f);
|
||||
}
|
||||
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_OK);
|
||||
send(reply, true);
|
||||
LOG("CustomerService",
|
||||
("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
|
||||
LOG("CustomerService", ("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,8 +264,7 @@ void ClientConnection::onCharacterDeletedFromLoginDatabase(const NetworkId &char
|
||||
void ClientConnection::onCharacterDeletedFromCluster(const NetworkId &characterId) {
|
||||
m_waitingForCharacterClusterDeletion = false;
|
||||
if (!m_waitingForCharacterLoginDeletion) {
|
||||
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(),
|
||||
m_charactersPendingDeletion.end(), characterId);
|
||||
std::vector<NetworkId>::iterator f = std::find(m_charactersPendingDeletion.begin(), m_charactersPendingDeletion.end(), characterId);
|
||||
if (f != m_charactersPendingDeletion.end()) {
|
||||
m_charactersPendingDeletion.erase(f);
|
||||
|
||||
@@ -292,8 +273,7 @@ void ClientConnection::onCharacterDeletedFromCluster(const NetworkId &characterI
|
||||
|
||||
DeleteCharacterReplyMessage reply(DeleteCharacterReplyMessage::rc_OK);
|
||||
send(reply, true);
|
||||
LOG("CustomerService",
|
||||
("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
|
||||
LOG("CustomerService", ("Player:deleted character %s for stationId %u at IP: %s", characterId.getValueString().c_str(), m_stationId, getRemoteAddress().c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user