mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-14 03:09:08 +00:00
Fixed: Crash in backup service
This commit is contained in:
parent
8a1b7d7836
commit
7f054799b4
4 changed files with 13 additions and 12 deletions
|
@ -36,7 +36,7 @@ NLMISC::CVariable<std::string> BSFileSubst("backup", "BSFileSubst", "file read/w
|
||||||
NLMISC::CVariable<bool> VerboseLog("backup", "VerboseLog", "Activate verbose logging of BS activity", false);
|
NLMISC::CVariable<bool> VerboseLog("backup", "VerboseLog", "Activate verbose logging of BS activity", false);
|
||||||
NLMISC::CVariable<bool> UseTempFile("backup", "UseTempFile", "Flag the use of temporary file for safe write or append operation", true, true);
|
NLMISC::CVariable<bool> UseTempFile("backup", "UseTempFile", "Flag the use of temporary file for safe write or append operation", true, true);
|
||||||
|
|
||||||
extern NLMISC::CVariable<std::string> SaveShardRootBackupService;
|
extern NLMISC::CVariable<std::string> SaveShardRootGameShare;
|
||||||
|
|
||||||
bool bsstrincmp(const char* s1, const char* s2, int n)
|
bool bsstrincmp(const char* s1, const char* s2, int n)
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,7 @@ bool bsstrincmp(const char* s1, const char* s2, int n)
|
||||||
|
|
||||||
std::string getBackupFileName(const std::string& filename)
|
std::string getBackupFileName(const std::string& filename)
|
||||||
{
|
{
|
||||||
return SaveShardRootBackupService.get() + filename;
|
return SaveShardRootGameShare.get() + filename;
|
||||||
/* // BSFilePrefix and BSFileSubst are deprecated
|
/* // BSFilePrefix and BSFileSubst are deprecated
|
||||||
if (BSFilePrefix.get().empty())
|
if (BSFilePrefix.get().empty())
|
||||||
return filename;
|
return filename;
|
||||||
|
|
|
@ -62,7 +62,7 @@ struct CBackupMsgSaveFileRecv
|
||||||
|
|
||||||
|
|
||||||
extern CDirectoryRateStat DirStats;
|
extern CDirectoryRateStat DirStats;
|
||||||
extern NLMISC::CVariable<std::string> SaveShardRootBackupService;
|
extern NLMISC::CVariable<std::string> SaveShardRootGameShare;
|
||||||
|
|
||||||
using namespace NLNET;
|
using namespace NLNET;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
@ -542,7 +542,7 @@ static CMessage getFileClassImp( CMessage& msgin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// In case something like getPathContent() has returned full paths, make paths relative to match the requested filenames
|
// In case something like getPathContent() has returned full paths, make paths relative to match the requested filenames
|
||||||
fdc.stripFilename(SaveShardRootBackupService.get());
|
fdc.stripFilename(SaveShardRootGameShare.get());
|
||||||
|
|
||||||
// compose the output message
|
// compose the output message
|
||||||
CMessage msgout("BS_FILE_CLASS");
|
CMessage msgout("BS_FILE_CLASS");
|
||||||
|
|
|
@ -30,7 +30,7 @@ using namespace NLNET;
|
||||||
|
|
||||||
CDirectoryRateStat DirStats;
|
CDirectoryRateStat DirStats;
|
||||||
|
|
||||||
extern CVariable<string> SaveShardRootBackupService;
|
extern CVariable<string> SaveShardRootGameShare;
|
||||||
|
|
||||||
|
|
||||||
NLMISC_COMMAND(displayFileStats, "display file read/write stats for the last minute", "")
|
NLMISC_COMMAND(displayFileStats, "display file read/write stats for the last minute", "")
|
||||||
|
@ -74,9 +74,9 @@ NLMISC_COMMAND ( dumpCharacterFile, "dump the content of the save file for a cha
|
||||||
{
|
{
|
||||||
// just output the list of available shard id
|
// just output the list of available shard id
|
||||||
vector<string> shards;
|
vector<string> shards;
|
||||||
CPath::getPathContent(SaveShardRootBackupService, false, true, false, shards);
|
CPath::getPathContent(SaveShardRootGameShare, false, true, false, shards);
|
||||||
|
|
||||||
log.displayNL("Listing %u available shard id in path '%s':", shards.size(), SaveShardRootBackupService.c_str());
|
log.displayNL("Listing %u available shard id in path '%s':", shards.size(), SaveShardRootGameShare.c_str());
|
||||||
for (uint i=0; i<shards.size(); ++i)
|
for (uint i=0; i<shards.size(); ++i)
|
||||||
{
|
{
|
||||||
string id = shards[i];
|
string id = shards[i];
|
||||||
|
@ -107,7 +107,7 @@ NLMISC_COMMAND ( dumpCharacterFile, "dump the content of the save file for a cha
|
||||||
useFilter = true;
|
useFilter = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
string fileName = SaveShardRootBackupService.toString()+"/"+args[0]+"/characters/account_"+args[1]+"_"+args[2]+"_pdr.bin";
|
string fileName = SaveShardRootGameShare.toString()+"/"+args[0]+"/characters/account_"+args[1]+"_"+args[2]+"_pdr.bin";
|
||||||
if (!CFile::isExists(fileName))
|
if (!CFile::isExists(fileName))
|
||||||
{
|
{
|
||||||
log.displayNL("The file '%s' (located here '%s') cannot be found in '%s' backup directory",
|
log.displayNL("The file '%s' (located here '%s') cannot be found in '%s' backup directory",
|
||||||
|
|
|
@ -169,7 +169,8 @@ void cbOnSaveShardRootModified( NLMISC::IVariable& var )
|
||||||
}
|
}
|
||||||
|
|
||||||
CVariable<string> IncrementalBackupDirectory("backup", "IncrementalBackupDirectory", "Directory to find incremental backuped archives", "", 0, true);
|
CVariable<string> IncrementalBackupDirectory("backup", "IncrementalBackupDirectory", "Directory to find incremental backuped archives", "", 0, true);
|
||||||
CVariable<string> SaveShardRootBackupService("backup", "SaveShardRoot", "Root directory of all saved data by BS", "/home/nevrax/save_shard", 0, true, cbOnSaveShardRootModified); // (SaveShardRoot from game_share/backup_service_interface.cpp is not instanciated because the nothing is used from that file)
|
//CVariable<string> SaveShardRootBackupService("backup", "SaveShardRoot", "Root directory of all saved data by BS", "/home/nevrax/save_shard", 0, true, cbOnSaveShardRootModified); // (SaveShardRoot from game_share/backup_service_interface.cpp is not instanciated because the nothing is used from that file)
|
||||||
|
extern CVariable<string> SaveShardRootGameShare;
|
||||||
CVariable<string> SaveTemplatePath("backup", "SaveTemplatePath", "Directory to find saves (with shard and account replacement strings)", "$shard/characters/account_$userid_$charid$ext", 0, true);
|
CVariable<string> SaveTemplatePath("backup", "SaveTemplatePath", "Directory to find saves (with shard and account replacement strings)", "$shard/characters/account_$userid_$charid$ext", 0, true);
|
||||||
CVariable<string> SaveExtList("backup", "SaveExtList", "List of possible extensions for save files (space separated)", "_pdr.bin _pdr.xml .bin", 0, true);
|
CVariable<string> SaveExtList("backup", "SaveExtList", "List of possible extensions for save files (space separated)", "_pdr.bin _pdr.xml .bin", 0, true);
|
||||||
|
|
||||||
|
@ -209,7 +210,7 @@ void cbGetSaveList(CMemStream &msgin, TSockId host)
|
||||||
explode(str, string("%%"), params, true);
|
explode(str, string("%%"), params, true);
|
||||||
|
|
||||||
string incrementalDir = IncrementalBackupDirectory.get();
|
string incrementalDir = IncrementalBackupDirectory.get();
|
||||||
string saveShardRoot = SaveShardRootBackupService.get();
|
string saveShardRoot = SaveShardRootGameShare.get();
|
||||||
string templatePath = SaveTemplatePath.get();
|
string templatePath = SaveTemplatePath.get();
|
||||||
string extList = SaveExtList.get();
|
string extList = SaveExtList.get();
|
||||||
|
|
||||||
|
@ -292,7 +293,7 @@ void cbRestoreSave(CMemStream &msgin, TSockId host)
|
||||||
|
|
||||||
explode(str, string("%%"), params, true);
|
explode(str, string("%%"), params, true);
|
||||||
|
|
||||||
string saveShardRoot = SaveShardRootBackupService.get();
|
string saveShardRoot = SaveShardRootGameShare.get();
|
||||||
string templatePath = SaveTemplatePath.get();
|
string templatePath = SaveTemplatePath.get();
|
||||||
|
|
||||||
string shard;
|
string shard;
|
||||||
|
@ -367,7 +368,7 @@ void cbCopyOverSave(CMemStream &msgin, TSockId host)
|
||||||
|
|
||||||
explode(str, string("%%"), params, true);
|
explode(str, string("%%"), params, true);
|
||||||
|
|
||||||
string saveShardRoot = SaveShardRootBackupService.get();
|
string saveShardRoot = SaveShardRootGameShare.get();
|
||||||
string templatePath = SaveTemplatePath.get();
|
string templatePath = SaveTemplatePath.get();
|
||||||
string extList = SaveExtList.get();
|
string extList = SaveExtList.get();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue