mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-14 23:07:48 -04:00
general cleanup; remove those mutexes and debug output as they didn't get us anywhere
This commit is contained in:
@@ -303,8 +303,6 @@ void Persister::startSave(void)
|
||||
|
||||
m_newObjectCount=0;
|
||||
|
||||
pad.lock();
|
||||
|
||||
// delete any characters for this save cycle
|
||||
if (m_charactersToDeleteNextSaveCycle && m_charactersToDeleteThisSaveCycle)
|
||||
{
|
||||
@@ -375,8 +373,6 @@ void Persister::startSave(void)
|
||||
|
||||
if (ConfigServerDatabase::getReportSaveTimes())
|
||||
m_saveStartTime = Clock::timeMs();
|
||||
|
||||
pad.unlock();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -515,12 +511,9 @@ void Persister::newObject(uint32 serverId, const NetworkId &objectId, int templa
|
||||
{
|
||||
UNREF(serverId);
|
||||
|
||||
pad.lock();
|
||||
|
||||
if (m_objectSnapshotMap.find(objectId)!=m_objectSnapshotMap.end())
|
||||
{
|
||||
DEBUG_WARNING(true,("Database received multiple new object messages for object %s",objectId.getValueString().c_str()));
|
||||
pad.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -575,8 +568,6 @@ void Persister::newObject(uint32 serverId, const NetworkId &objectId, int templa
|
||||
NOT_NULL(snap);
|
||||
snap->newObject(objectId, templateId, typeId);
|
||||
m_objectSnapshotMap[objectId]=snap;
|
||||
|
||||
pad.unlock();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -589,9 +580,6 @@ void Persister::newObject(uint32 serverId, const NetworkId &objectId, int templa
|
||||
|
||||
void Persister::endBaselines(const NetworkId &objectId, uint32 serverId)
|
||||
{
|
||||
|
||||
pad.lock();
|
||||
|
||||
//TODO: This is a hack until we remove frame boundaries and have "end frame" messages from the game server. Apparently the game
|
||||
// server can split baselines across frame boundaries, so we can't assume we have all the data for a character when we hit a
|
||||
// frame bounday.
|
||||
@@ -601,8 +589,6 @@ void Persister::endBaselines(const NetworkId &objectId, uint32 serverId)
|
||||
m_pendingCharacters.erase(chardata);
|
||||
m_newCharacterLock.erase(serverId);
|
||||
}
|
||||
|
||||
pad.unlock();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -613,65 +599,57 @@ void Persister::endBaselines(const NetworkId &objectId, uint32 serverId)
|
||||
|
||||
void Persister::saveCompleted(Snapshot *completedSnapshot)
|
||||
{
|
||||
pad.lock();
|
||||
|
||||
auto i=std::remove(m_savingSnapshots.begin(),m_savingSnapshots.end(),completedSnapshot);
|
||||
if (i!=m_savingSnapshots.end())
|
||||
{
|
||||
m_savingSnapshots.erase(i, m_savingSnapshots.end());
|
||||
|
||||
if (completedSnapshot != nullptr) {
|
||||
delete completedSnapshot;
|
||||
completedSnapshot = nullptr;
|
||||
bool found = false;
|
||||
for (auto i = m_savingSnapshots.begin(); i != m_savingSnapshots.end();) {
|
||||
if (*i == completedSnapshot) {
|
||||
i = m_savingSnapshots.erase(i);
|
||||
found = true;
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_savingSnapshots.empty() && ConfigServerDatabase::getReportSaveTimes())
|
||||
{
|
||||
if (m_savingSnapshots.empty())
|
||||
{
|
||||
if (found && ConfigServerDatabase::getReportSaveTimes()) {
|
||||
int saveTime = Clock::timeMs() - m_saveStartTime;
|
||||
++m_saveCount;
|
||||
m_totalSaveTime += saveTime;
|
||||
if (saveTime > m_maxSaveTime)
|
||||
m_maxSaveTime = saveTime;
|
||||
|
||||
DEBUG_REPORT_LOG(true,("Save completed in %i. (Average %i, max %i)\n", saveTime, m_totalSaveTime/m_saveCount, m_maxSaveTime));
|
||||
LOG("SaveTimes",("Save completed in %i. (Average %i, max %i)", saveTime, m_totalSaveTime/m_saveCount, m_maxSaveTime));
|
||||
|
||||
m_lastSaveTime = saveTime;
|
||||
DEBUG_REPORT_LOG(true,("Save completed in %i. (Average %i, max %i)\n", saveTime, m_totalSaveTime/m_saveCount, m_maxSaveTime));
|
||||
LOG("SaveTimes",("Save completed in %i. (Average %i, max %i)", saveTime, m_totalSaveTime/m_saveCount, m_maxSaveTime));
|
||||
|
||||
m_lastSaveTime = saveTime;
|
||||
}
|
||||
|
||||
if (m_savingSnapshots.empty())
|
||||
{
|
||||
// message Central Server that the current save cycle is complete
|
||||
GenericValueTypeMessage<int> const saveCompleteMessage("DatabaseSaveComplete", ++m_saveCounter);
|
||||
DatabaseProcess::getInstance().sendToCentralServer(saveCompleteMessage, true);
|
||||
LOG("Database",("Sending DatabaseSaveComplete network message to Central."));
|
||||
}
|
||||
LOG("Database",("Sending DatabaseSaveComplete network message to Central."));
|
||||
|
||||
{
|
||||
// set the last save completion time (for the monitoring program)
|
||||
time_t theTime = time(0);
|
||||
m_lastSaveCompletionTime = ctime(&theTime);
|
||||
}
|
||||
// TODO: so do we send this for the other snapshot type or not? hrmph
|
||||
// message Central Server that the current save cycle is complete
|
||||
GenericValueTypeMessage<int> const saveCompleteMessage("DatabaseSaveComplete", ++m_saveCounter);
|
||||
DatabaseProcess::getInstance().sendToCentralServer(saveCompleteMessage, true);
|
||||
LOG("Database",("Sending DatabaseSaveComplete network message to Central."));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto j=std::remove(m_savingCharacterSnapshots.begin(),m_savingCharacterSnapshots.end(),completedSnapshot);
|
||||
|
||||
DEBUG_FATAL(i==m_savingCharacterSnapshots.end(),("Programmer bug: SaveCompleted() called with a snapshot that wasn't in m_savingSnapshots or m_savingCharacterSnapshots."));
|
||||
|
||||
if (j != m_savingCharacterSnapshots.end()) {
|
||||
m_savingCharacterSnapshots.erase(j, m_savingCharacterSnapshots.end());
|
||||
|
||||
if (!found) {
|
||||
for (auto i = m_savingCharacterSnapshots.begin(); i != m_savingCharacterSnapshots.end();) {
|
||||
if (*i == completedSnapshot) {
|
||||
i = m_savingCharacterSnapshots.erase(i);
|
||||
found = true;
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if (completedSnapshot != nullptr) {
|
||||
delete completedSnapshot;
|
||||
completedSnapshot = nullptr;
|
||||
}
|
||||
|
||||
|
||||
DEBUG_REPORT_LOG(ConfigServerDatabase::getReportSaveTimes(),("New character save completed\n"));
|
||||
}
|
||||
|
||||
pad.unlock();
|
||||
if (found && completedSnapshot != nullptr) {
|
||||
delete completedSnapshot;
|
||||
completedSnapshot = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
#include <vector>
|
||||
#include <set> //TODO: remove when we clean up newCharacterLock hack
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include "Unicode.h"
|
||||
#include "serverNetworkMessages/MessageToPayload.h"
|
||||
#include "sharedDatabaseInterface/DbModeQuery.h"
|
||||
@@ -99,8 +97,6 @@ class Persister : public MessageDispatch::Receiver
|
||||
DB::TaskQueue *m_newCharacterTaskQueue;
|
||||
|
||||
private:
|
||||
std::mutex pad;
|
||||
|
||||
struct PendingCharacter
|
||||
{
|
||||
uint32 stationId;
|
||||
|
||||
@@ -4768,15 +4768,10 @@ void GameServer::handleCharacterCreateNameVerification(const VerifyNameResponse
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Set up the PlayerObject
|
||||
|
||||
WARNING(true, ("Setting up the PlayerObject for %s", vrn.getName().c_str()));
|
||||
|
||||
ServerObject *playerServerObject = ServerWorld::createNewObject(ConfigServerGame::getPlayerObjectTemplate(), *newCharacterObject, false);
|
||||
PlayerObject *play = dynamic_cast<PlayerObject*>(playerServerObject);
|
||||
if (play)
|
||||
{
|
||||
WARNING(true, ("Player object is good..."));
|
||||
|
||||
play->setStationId(createMessage->getStationId());
|
||||
play->setBornDate();
|
||||
play->setSkillTemplate(createMessage->getSkillTemplate(), true);
|
||||
@@ -4811,8 +4806,6 @@ void GameServer::handleCharacterCreateNameVerification(const VerifyNameResponse
|
||||
WARNING_STRICT_FATAL(true,("Unable to create PlayerObject for new character %s.\n",newCharacterObject->getNetworkId().getValueString().c_str()));
|
||||
}
|
||||
|
||||
|
||||
WARNING(true, ("Setting scene and sending to DB for persist."));
|
||||
newCharacterObject->setSceneIdOnThisAndContents(createMessage->getPlanetName());
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user