From 04fff0638ee249917c338da2e19a3324eeb5e322 Mon Sep 17 00:00:00 2001 From: swg Date: Thu, 5 May 2016 08:34:45 +0100 Subject: [PATCH] Revert "help me, this doesnt build at all .." This reverts commit dc2b683c42d4948eaaa5f6a83cc5f0cd611a6e06. Wrong branch, wrong everything, should not do stuff when tired ... --- .../CentralServer/src/CMakeLists.txt | 3 - .../src/shared/CentralServer.cpp | 129 +++++++++++------- 2 files changed, 80 insertions(+), 52 deletions(-) mode change 100755 => 100644 engine/server/application/CentralServer/src/CMakeLists.txt diff --git a/engine/server/application/CentralServer/src/CMakeLists.txt b/engine/server/application/CentralServer/src/CMakeLists.txt old mode 100755 new mode 100644 index 1bfd4dd6..338554da --- a/engine/server/application/CentralServer/src/CMakeLists.txt +++ b/engine/server/application/CentralServer/src/CMakeLists.txt @@ -154,7 +154,6 @@ include_directories( ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/projects ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/platform/utils ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/udplibrary - ${SWG_EXTERNALS_SOURCE_DIR}/3rd/library/webAPI ) add_executable(CentralServer @@ -191,7 +190,5 @@ target_link_libraries(CentralServer localizationArchive unicode unicodeArchive - webAPI - ${CURL_LIBRARIES} ${CMAKE_DL_LIBS} ) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 7918cb53..35d9e51c 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -123,9 +123,6 @@ #include -// Trying todo something here ... -#include "webAPI.h" - namespace CentralServerNamespace { bool gs_connectionServersPublic=false; @@ -590,7 +587,7 @@ void CentralServer::getReadyGameServers(std::vector &theList) GameServerConnection * CentralServer::getRandomGameServer(void) { if (m_gameServerConnectionsList.empty()) - return nullptr; + return NULL; // m_gameServerConnectionsList ***DOES NOT*** contain the DB server so // we don't have to worry about checking for and excluding the DB server @@ -614,7 +611,7 @@ GameServerConnection * CentralServer::getRandomGameServer(void) indexNextGameServer = 0; } - return nullptr; + return NULL; } //----------------------------------------------------------------------- @@ -699,7 +696,7 @@ void CentralServer::launchStartingProcesses() const if (!m_taskManager || !m_taskManager->isConnected() || (m_clusterId == 0)) { if (!m_taskManager) - REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is nullptr\n")); + REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager is NULL\n")); else if (!m_taskManager->isConnected()) REPORT_LOG(true, ("CentralServer not launching starting processes because m_taskManager->isConnected() is false\n")); @@ -823,7 +820,7 @@ void CentralServer::launchStartingPlanetServers() char const * const p = ConfigCentralServer::getStartPlanet(i); if (p) { - FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-nullptr but empty planet name", i)); + FATAL(!*p, ("CentralServer::launchStartingPlanetServers: ConfigCentralServer::getStartPlanet(%d) specified a non-null but empty planet name", i)); std::string planetName; std::string hostName; @@ -1069,12 +1066,59 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons // Forward this message to the dbProcess sendToGameServer(m_dbProcessServerProcessId, t, true); } + else if(message.isType("ChunkObjectListMessage")) + { + Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); + ChunkObjectListMessage t(ri); + + DEBUG_FATAL(true,("Got ChunkObjectListMessage. Thought it was deprecated.\n")); + // handleChunkList(t.getProcess(), t.getIds()); + } else if(message.isType("LocateStructureMessage")) { Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); LocateStructureMessage t(ri); sendToPlanetServer(t.getSceneId(), t, true); } + else if(message.isType("RequestObjectMessage")) + { + DEBUG_FATAL(true,("Got RequestObjectMessage. Thought this went away.")); + + // Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); + // RequestObjectMessage t(ri); + // // tell the authoritative object to create a proxy + // const GameServerConnection *gameServer = getGameServer(t.getProcess()); + // NOT_NULL(gameServer); + // uint32 authId = sendToAuthoritativeServer(t.getId(), + // LoadObjectMessage(t.getId(), t.getProcess(), gameServer->getGameServiceAddress(), gameServer->getGameServicePort(), false), + // true); + // // if we sent the message to the database process, mark it as being + // // authoritative for this object + // if (authId == m_dbProcessServerProcessId) + // { + // addObjectToMap(t.getId(), authId, gameServer->getSceneId(), true); + // m_pendingLoadingObjects[t.getId()] = t.getProcess(); + // } + } + else if(message.isType("CreateNewObjectMessage")) + { + DEBUG_FATAL(true,("Ain't this supposed to be deprecated or something?")); + } + else if(message.isType("SetObjectPositionMessage")) + { + //@todo remove this message from the library + DEBUG_FATAL(true,("Got SetObjectPositionMessage. Thought this went away")); + } + else if(message.isType("FailedToLoadObjectMessage")) + { + //@todo remove this message from the library + DEBUG_FATAL(true,("Received Failed To Load Object Message. Thought it was depricated\n")); + } + else if(message.isType("ReleaseAuthoritativeMessage")) + { + //@todo remove this message from the library + DEBUG_FATAL(true, ("Received ReleaseAuthoritative for. Thought it was deprecated.")); + } else if(message.isType("ForceUnloadObjectMessage")) { //N.B. This message can come from a game server or from the planet server. @@ -1084,7 +1128,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons ForceUnloadObjectMessage t(ri); //@todo: figure out some way to handle this (such as forwarding to PlanetServers), or remove every case where it's sent - //forceUnload(t.getId(),t.getPermaDelete()); + // forceUnload(t.getId(),t.getPermaDelete()); } //Character Creation Messages else if(message.isType("ConnectionCreateCharacter")) @@ -1451,7 +1495,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != nullptr) + if ( (c != NULL) && !c->getChatServiceAddress().empty() && (c->getChatServicePort() != 0)) { @@ -1493,13 +1537,13 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ChatServerConnection *connection = (*iterChatServerConnections); - if (connection != nullptr) + if (connection != NULL) { connection->send(address, true); } else { - REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a nullptr chat server\n")); + REPORT_LOG(true, ("Trying to send the customer service server: chat server service address to a NULL chat server\n")); } } } @@ -1512,7 +1556,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { ConnectionServerConnection * c = (*ci); - if ( (c != nullptr) + if ( (c != NULL) && !c->getCustomerServiceAddress().empty() && (c->getCustomerServicePort() != 0)) { @@ -1587,7 +1631,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); const RequestGameServerForLoginMessage msg(ri); - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); PlayerSceneMapType::const_iterator i = m_playerSceneMap.find(msg.getCharacterId()); if ((i != m_playerSceneMap.end()) && (i->second.second > timeNow)) { @@ -1848,14 +1892,14 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons } else { - if(getInstance().m_transferServerConnection != nullptr) + if(getInstance().m_transferServerConnection != NULL) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != nullptr) + if(getInstance().m_stationPlayersCollectorConnection != NULL) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -1903,11 +1947,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons if (iterFind != s_pendingRenameCharacter.end()) { ++(iterFind->second.second); - iterFind->second.first = ::time(nullptr) + 3600; // 1 hour timeout + iterFind->second.first = ::time(NULL) + 3600; // 1 hour timeout } else { - s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(nullptr) + 3600), 1))); // 1 hour timeout + s_pendingRenameCharacter.insert(std::make_pair(msg.getValue().second.first, std::make_pair((::time(NULL) + 3600), 1))); // 1 hour timeout } // tell the chat server to destroy any avatar with the new name, but only if the first name changed @@ -2055,11 +2099,11 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons { i->second.first = ssfp.getValue().second.first; if (ssfp.getValue().second.second) - i->second.second = ::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); + i->second.second = ::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds()); } else { - m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(nullptr) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); + m_playerSceneMap[ssfp.getValue().first]=std::make_pair(ssfp.getValue().second.first, (ssfp.getValue().second.second ? (::time(NULL) + static_cast(ConfigCentralServer::getCtsDenyLoginThresholdSeconds())) : 0)); } } } @@ -2206,7 +2250,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage > const msg(ri); - m_timePopulationStatisticsRefresh = ::time(nullptr); + m_timePopulationStatisticsRefresh = ::time(NULL); m_populationStatistics = msg.getValue(); } else if (message.isType("GcwScoreStatRsp")) @@ -2214,7 +2258,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage, std::pair >, std::map > > > > const msg(ri); - m_timeGcwScoreStatisticsRefresh = ::time(nullptr); + m_timeGcwScoreStatisticsRefresh = ::time(NULL); std::string const timeGcwScoreStatisticsRefreshStr = CalendarTime::convertEpochToTimeStringLocal(m_timeGcwScoreStatisticsRefresh); std::map const & gcwImperialScorePercentile = msg.getValue().first; @@ -2286,7 +2330,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons Archive::ReadIterator ri = static_cast(message).getByteStream().begin(); GenericValueTypeMessage >, std::map > > > const msg(ri); - m_timeLastLoginTimeStatisticsRefresh = ::time(nullptr); + m_timeLastLoginTimeStatisticsRefresh = ::time(NULL); m_lastLoginTimeStatistics = msg.getValue().first; m_createTimeStatistics = msg.getValue().second; } @@ -2562,7 +2606,7 @@ void CentralServer::removeGameServer(GameServerConnection const *gameServer) } else { - DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is nullptr.")); + DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is null.")); } } @@ -2770,19 +2814,7 @@ void CentralServer::update() { static int loopCount=0; m_curTime = static_cast(time(0)); - - // stella: Adding those for sending regular updates through WebAPI to the webserver - - static int population=0; - population = CentralServer::getInstance().getPlayerCount(); - std::string authURL(ConfigLoginServer::getExternalAuthUrl()); - - postBuf << "population=" << population; - postData = std::string(postBuf.str()); - - - // Tell the LoginServers if necessary if ((++loopCount > ConfigCentralServer::getUpdatePlayerCountFrequency())) { @@ -2790,14 +2822,13 @@ void CentralServer::update() // Update the population on the server sendPopulationUpdateToLoginServer(); - webAPI::simplePost(authURL, postData, ""); } if ( ConfigCentralServer::getAuctionEnabled() ) // allow auctions? { - if ( m_pAuctionTransferClient == nullptr ) + if ( m_pAuctionTransferClient == NULL ) { const char* hostName[1] = { ConfigCentralServer::getAuctionServer() }; const short port[1] = { (short)ConfigCentralServer::getAuctionPort() }; @@ -2944,7 +2975,7 @@ void CentralServer::sendToPlanetServer(const std::string &sceneId, const GameNet // ---------------------------------------------------------------------- -void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= nullptr*/) +void CentralServer::sendToAllConnectionServers(const GameNetworkMessage & message, const bool reliable, Connection const * exclude /*= NULL*/) { // send to all connection servers for (ConnectionServerConnectionList::const_iterator i = m_connectionServerConnections.begin(); i != m_connectionServerConnections.end(); ++i) @@ -2974,7 +3005,7 @@ void CentralServer::sendToDBProcess(const GameNetworkMessage & message, const bo bool CentralServer::hasDBConnection() const { const GameServerConnection * g = getGameServer(getDbProcessServerProcessId()); - return (g != nullptr); + return (g != NULL); } //----------------------------------------------------------------------- @@ -3079,7 +3110,7 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin TaskSpawnProcess spawn(host.empty() ? std::string("any") : host, "PlanetServer", options, spawnDelay); CentralServer::getInstance().sendTaskMessage(spawn); - m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(nullptr)); + m_pendingPlanetServers[sceneId] = std::make_pair(std::make_pair(host, options), ::time(NULL)); IGNORE_RETURN(m_planetsWaitingForPreload.insert(sceneId)); bool const preloadFinished = isPreloadFinished(); @@ -3088,14 +3119,14 @@ void CentralServer::startPlanetServer(const std::string & host, const std::strin else if (m_timeClusterWentIntoLoadingState <= 0) m_timeClusterWentIntoLoadingState = time(0); - if(getInstance().m_transferServerConnection != nullptr && !preloadFinished) + if(getInstance().m_transferServerConnection != NULL && !preloadFinished) { getInstance().m_transferServerConnection->disconnect(); getInstance().m_transferServerConnection = 0; s_retryTransferServerConnection = false; } - if(getInstance().m_stationPlayersCollectorConnection != nullptr && ! isPreloadFinished()) + if(getInstance().m_stationPlayersCollectorConnection != NULL && ! isPreloadFinished()) { getInstance().m_stationPlayersCollectorConnection->disconnect(); getInstance().m_stationPlayersCollectorConnection = 0; @@ -3232,7 +3263,7 @@ void CentralServer::handleGameServerForLoginMessage(const GameServerForLoginMess void CentralServer::handleExchangeListCreditsMessage(const ExchangeListCreditsMessage &msg) { LOG("Exchange", ("Central Server got exchange list credits %d.",msg.getCredits())); - if ( m_pAuctionTransferClient == nullptr ) + if ( m_pAuctionTransferClient == NULL ) { // send failure packet } @@ -3268,7 +3299,7 @@ ConnectionServerConnection * CentralServer::getAnyConnectionServer() ConnectionServerConnection * CentralServer::getConnectionServerForAccount(StationId suid) { - ConnectionServerConnection * result = nullptr; + ConnectionServerConnection * result = NULL; ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid); if (i!=m_accountConnectionMap.end()) { @@ -3676,7 +3707,7 @@ void CentralServer::checkShutdownProcess() { // if it's been "awhile" since we requested to restart the PlanetServer, // then assume that something has gone wrong, and try the restart again - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if ((iterPendingPlanetServer->second.second + static_cast(ConfigCentralServer::getMaxTimeToWaitForPlanetServerStartSeconds())) < timeNow) { @@ -3951,7 +3982,7 @@ int CentralServer::getSecondsClusterHasBeenInLoadingState() const const std::map & CentralServer::getPopulationStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if (m_timePopulationStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -3973,7 +4004,7 @@ const std::map & CentralServer::getPopulationStatistics(time_t const std::map > > & CentralServer::getGcwScoreStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if (m_timeGcwScoreStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -3995,7 +4026,7 @@ const std::map > std::pair > const *, std::map > const *> CentralServer::getLastLoginTimeStatistics(time_t & refreshTime) { // periodically request updated statistics from the game server - time_t const timeNow = ::time(nullptr); + time_t const timeNow = ::time(NULL); if (m_timeLastLoginTimeStatisticsNextRefresh <= timeNow) { GameServerConnection * universeGameServerConnection = getGameServer(UniverseManager::getInstance().getUniverseProcess()); @@ -4018,7 +4049,7 @@ std::pair > const *, std::map characterMatchStatisticsRequest("LfgStatReq", 0);