mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[9904] Add new config option for wait mode at startup error.
Note: it not applied to crashes and shutdowns after mangosd/relamd startup completed. You can continue without delay (as now) and fast exist, or wait <Enter>, or some secs for continue. Last can be helpful for see for example not applied sql update revision data and etc.
This commit is contained in:
parent
f492ee6794
commit
aaa33d5385
10 changed files with 67 additions and 11 deletions
|
|
@ -4269,7 +4269,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
|
|||
QueryResult *resultChars = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Account FROM characters WHERE deleteDate IS NOT NULL AND deleteDate < '" UI64FMTD "'", uint64(time(NULL) - time_t(keepDays * DAY)));
|
||||
if (resultChars)
|
||||
{
|
||||
sLog.outString("Player::DeleteOldChars: Found %u character(s) to delete",resultChars->GetRowCount());
|
||||
sLog.outString("Player::DeleteOldChars: Found %u character(s) to delete",uint32(resultChars->GetRowCount()));
|
||||
do
|
||||
{
|
||||
Field *charFields = resultChars->Fetch();
|
||||
|
|
|
|||
|
|
@ -419,9 +419,7 @@ void World::LoadConfigSettings(bool reload)
|
|||
sLog.outError(" WARNING: mangosd.conf does not include a ConfVersion variable.");
|
||||
sLog.outError(" Your configuration file may be out of date!");
|
||||
sLog.outError("*****************************************************************************");
|
||||
clock_t pause = 3000 + clock();
|
||||
while (pause > clock())
|
||||
; // empty body
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -432,9 +430,7 @@ void World::LoadConfigSettings(bool reload)
|
|||
sLog.outError(" Please check for updates, as your current default values may cause");
|
||||
sLog.outError(" unexpected behavior.");
|
||||
sLog.outError("*****************************************************************************");
|
||||
clock_t pause = 3000 + clock();
|
||||
while (pause > clock())
|
||||
; // empty body
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ extern int main(int argc, char **argv)
|
|||
{
|
||||
sLog.outError("Runtime-Error: -s option requires an input argument");
|
||||
usage(argv[0]);
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
if( strcmp(argv[c],"install") == 0)
|
||||
|
|
@ -126,6 +127,7 @@ extern int main(int argc, char **argv)
|
|||
{
|
||||
sLog.outError("Runtime-Error: unsupported option %s",argv[c]);
|
||||
usage(argv[0]);
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -141,6 +143,7 @@ extern int main(int argc, char **argv)
|
|||
if (!sConfig.SetSource(cfg_file))
|
||||
{
|
||||
sLog.outError("Could not find configuration file %s.", cfg_file);
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ int Master::Run()
|
|||
if( !pid )
|
||||
{
|
||||
sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() );
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +203,10 @@ int Master::Run()
|
|||
|
||||
///- Start the databases
|
||||
if (!_StartDB())
|
||||
{
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
|
||||
///- Initialize the World
|
||||
sWorld.SetInitialWorldSettings();
|
||||
|
|
@ -315,6 +319,7 @@ int Master::Run()
|
|||
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip) == -1)
|
||||
{
|
||||
sLog.outError ("Failed to start network");
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
// go down and shutdown the server
|
||||
}
|
||||
|
|
|
|||
|
|
@ -669,6 +669,12 @@ LogColors = ""
|
|||
# Default: 1 (true)
|
||||
# 0 (false)
|
||||
#
|
||||
# WaitAtStartupError
|
||||
# After startup error report wait <Enter> or some time before continue (and possible close console window)
|
||||
# -1 (wait until <Enter> press)
|
||||
# Default: 0 (not wait)
|
||||
# N (>0, wait N secs)
|
||||
#
|
||||
# Motd
|
||||
# Message of the Day. Displayed at worldlogin for every user ('@' for a newline).
|
||||
#
|
||||
|
|
@ -733,6 +739,7 @@ OffhandCheckAtTalentsReset = 0
|
|||
ClientCacheVersion = 0
|
||||
Event.Announce = 0
|
||||
BeepAtStart = 1
|
||||
WaitAtStartupError = 0
|
||||
Motd = "Welcome to the Massive Network Game Object Server."
|
||||
|
||||
###################################################################################################################
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ extern int main(int argc, char **argv)
|
|||
{
|
||||
sLog.outError("Runtime-Error: -c option requires an input argument");
|
||||
usage(argv[0]);
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
|
@ -109,6 +110,7 @@ extern int main(int argc, char **argv)
|
|||
{
|
||||
sLog.outError("Runtime-Error: -s option requires an input argument");
|
||||
usage(argv[0]);
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
if( strcmp(argv[c],"install") == 0)
|
||||
|
|
@ -127,6 +129,7 @@ extern int main(int argc, char **argv)
|
|||
{
|
||||
sLog.outError("Runtime-Error: unsupported option %s",argv[c]);
|
||||
usage(argv[0]);
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -142,6 +145,7 @@ extern int main(int argc, char **argv)
|
|||
if (!sConfig.SetSource(cfg_file))
|
||||
{
|
||||
sLog.outError("Could not find configuration file %s.", cfg_file);
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
sLog.Initialize();
|
||||
|
|
@ -159,9 +163,7 @@ extern int main(int argc, char **argv)
|
|||
sLog.outError(" Please check for updates, as your current default values may cause");
|
||||
sLog.outError(" strange behavior.");
|
||||
sLog.outError("*****************************************************************************");
|
||||
clock_t pause = 3000 + clock();
|
||||
|
||||
while (pause > clock()) {}
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
}
|
||||
|
||||
DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
|
||||
|
|
@ -179,6 +181,7 @@ extern int main(int argc, char **argv)
|
|||
if( !pid )
|
||||
{
|
||||
sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() );
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -187,13 +190,17 @@ extern int main(int argc, char **argv)
|
|||
|
||||
///- Initialize the database connection
|
||||
if(!StartDB())
|
||||
{
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
|
||||
///- Get the list of realms for the server
|
||||
sRealmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
|
||||
if (sRealmList.size() == 0)
|
||||
{
|
||||
sLog.outError("No valid realms specified.");
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -206,6 +213,7 @@ extern int main(int argc, char **argv)
|
|||
if ( authListenSocket.Bind(bind_ip.c_str(),rmport))
|
||||
{
|
||||
sLog.outError( "MaNGOS realmd can not bind to %s:%d",bind_ip.c_str(), rmport );
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,12 @@ ConfVersion=2007062001
|
|||
# Default: 1 (HIGH)
|
||||
# 0 (Normal)
|
||||
#
|
||||
# WaitAtStartupError
|
||||
# After startup error report wait <Enter> or some time before continue (and possible close console window)
|
||||
# -1 (wait until <Enter> press)
|
||||
# Default: 0 (not wait)
|
||||
# N (>0, wait N secs)
|
||||
#
|
||||
# RealmsStateUpdateDelay
|
||||
# Realm list Update up delay (updated at realm list request if delay expired).
|
||||
# Default: 20
|
||||
|
|
@ -110,6 +116,7 @@ LogFileLevel = 0
|
|||
LogColors = ""
|
||||
UseProcessors = 0
|
||||
ProcessPriority = 1
|
||||
WaitAtStartupError = 0
|
||||
RealmsStateUpdateDelay = 20
|
||||
WrongPass.MaxCount = 0
|
||||
WrongPass.BanTime = 600
|
||||
|
|
|
|||
|
|
@ -22,8 +22,13 @@
|
|||
#include "Config/ConfigEnv.h"
|
||||
#include "Util.h"
|
||||
#include "ByteBuffer.h"
|
||||
#include "ProgressBar.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "ace/OS_NS_unistd.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1( Log );
|
||||
|
||||
|
|
@ -815,6 +820,29 @@ void Log::outRALog( const char * str, ... )
|
|||
fflush(stdout);
|
||||
}
|
||||
|
||||
void Log::WaitBeforeContinueIfNeed()
|
||||
{
|
||||
int mode = sConfig.GetIntDefault("WaitAtStartupError",0);
|
||||
|
||||
if (mode < 0)
|
||||
{
|
||||
printf("\nPress <Enter> for continue\n");
|
||||
|
||||
std::string line;
|
||||
std::getline (std::cin, line);
|
||||
}
|
||||
else if (mode > 0)
|
||||
{
|
||||
printf("\nWait %u secs for continue.\n",mode);
|
||||
barGoLink bar(mode);
|
||||
for(int i = 0; i < mode; ++i)
|
||||
{
|
||||
bar.step();
|
||||
ACE_OS::sleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void outstring_log(const char * str, ...)
|
||||
{
|
||||
if (!str)
|
||||
|
|
|
|||
|
|
@ -140,6 +140,8 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ACE_Th
|
|||
bool HasLogLevelOrHigher(LogLevel loglvl) const { return m_logLevel >= loglvl || (m_logFileLevel >= loglvl && logfile); }
|
||||
bool IsOutCharDump() const { return m_charLog_Dump; }
|
||||
bool IsIncludeTime() const { return m_includeTime; }
|
||||
|
||||
static void WaitBeforeContinueIfNeed();
|
||||
private:
|
||||
FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode);
|
||||
FILE* openGmlogPerAccount(uint32 account);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9903"
|
||||
#define REVISION_NR "9904"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue