From 00fef810e75a834d548a166b8d143acb3123701b Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 6 Aug 2016 02:00:49 +0000 Subject: [PATCH] prevent the insanity of specifying (usually) defaults --- .../application/CentralServer/src/shared/CentralServer.cpp | 4 ++-- .../application/LoginServer/src/shared/ClientConnection.cpp | 3 ++- external/3rd/library/webAPI/webAPI.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 01461537..5772a345 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2864,14 +2864,14 @@ void CentralServer::sendPopulationUpdateToLoginServer() sendToAllLoginServers(upm); } -// TODO: make this togglable on/off in a config setting +// TODO: for sending metrics and such, would it make more sense to pass an object instead of a huge assed string as below? void CentralServer::sendMetricsToWebAPI(std::string updateURL) { std::ostringstream postBuf; postBuf << "totalPlayerCount=" << m_totalPlayerCount << "&totalGameServers=" << m_gameServers.size() - 1 << "&totalPlanetServers=" << m_planetServers.size() << "&isPublic=" << getIsClusterPublic() << "&isLocked=" << getIsClusterLocked() << "&isSecret=" << getIsClusterSecret() << "&preloadFinished=" << getClusterStartupTime() << "&databasebacklogged=" << isDatabaseBacklogged() << "&totalTutorialSceneCount=" << m_totalTutorialSceneCount << "&totalFalconSceneCount=" << m_totalFalconSceneCount; - webAPI::statusMessage response = webAPI::simplePost(updateURL, std::string(postBuf.str()), "status", "message", "status", "success"); + webAPI::statusMessage response = webAPI::simplePost(updateURL, std::string(postBuf.str())); WARNING(response.status, ("Error sending stats: %s", response.message.c_str())); } diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 007b0bb0..513e4432 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -182,7 +182,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string std::ostringstream postBuf; postBuf << "user_name=" << id << "&user_password=" << key << "&ip=" << getRemoteAddress(); - const webAPI::statusMessage response = webAPI::simplePost(authURL, std::string(postBuf.str()), "username", "message", "status", "success"); + const webAPI::statusMessage response = webAPI::simplePost(authURL, std::string(postBuf.str()), "username"); if (response.status && !response.message.empty()) { @@ -215,6 +215,7 @@ void ClientConnection::validateClient(const std::string & id, const std::string } LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), uname.c_str())); + LoginServer::getInstance().onValidateClient(suid, uname, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF); } // else this case will never be reached, noop diff --git a/external/3rd/library/webAPI/webAPI.h b/external/3rd/library/webAPI/webAPI.h index 4f50cad6..ca61934e 100644 --- a/external/3rd/library/webAPI/webAPI.h +++ b/external/3rd/library/webAPI/webAPI.h @@ -35,7 +35,7 @@ namespace webAPI using namespace std; - statusMessage simplePost(const string &endpoint, const string &data, const string &slotName, const string &messageSlot, const string &statusSlot, const string &statusVal); + statusMessage simplePost(const string &endpoint, const string &data, const string &slotName = "success", const string &messageSlot ="message", const string &statusSlot = "status", const string &statusVal = "success"); nlohmann::json request(const string &endpoint, const string &data, const int &reqType); // 1 for post, 0 for get size_t writeCallback(void *contents, size_t size, size_t nmemb, void *userp); };