mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +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)));
|
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)
|
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
|
do
|
||||||
{
|
{
|
||||||
Field *charFields = resultChars->Fetch();
|
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(" WARNING: mangosd.conf does not include a ConfVersion variable.");
|
||||||
sLog.outError(" Your configuration file may be out of date!");
|
sLog.outError(" Your configuration file may be out of date!");
|
||||||
sLog.outError("*****************************************************************************");
|
sLog.outError("*****************************************************************************");
|
||||||
clock_t pause = 3000 + clock();
|
Log::WaitBeforeContinueIfNeed();
|
||||||
while (pause > clock())
|
|
||||||
; // empty body
|
|
||||||
}
|
}
|
||||||
else
|
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(" Please check for updates, as your current default values may cause");
|
||||||
sLog.outError(" unexpected behavior.");
|
sLog.outError(" unexpected behavior.");
|
||||||
sLog.outError("*****************************************************************************");
|
sLog.outError("*****************************************************************************");
|
||||||
clock_t pause = 3000 + clock();
|
Log::WaitBeforeContinueIfNeed();
|
||||||
while (pause > clock())
|
|
||||||
; // empty body
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ extern int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
sLog.outError("Runtime-Error: -s option requires an input argument");
|
sLog.outError("Runtime-Error: -s option requires an input argument");
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if( strcmp(argv[c],"install") == 0)
|
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]);
|
sLog.outError("Runtime-Error: unsupported option %s",argv[c]);
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -141,6 +143,7 @@ extern int main(int argc, char **argv)
|
||||||
if (!sConfig.SetSource(cfg_file))
|
if (!sConfig.SetSource(cfg_file))
|
||||||
{
|
{
|
||||||
sLog.outError("Could not find configuration file %s.", cfg_file);
|
sLog.outError("Could not find configuration file %s.", cfg_file);
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,7 @@ int Master::Run()
|
||||||
if( !pid )
|
if( !pid )
|
||||||
{
|
{
|
||||||
sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() );
|
sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() );
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,7 +203,10 @@ int Master::Run()
|
||||||
|
|
||||||
///- Start the databases
|
///- Start the databases
|
||||||
if (!_StartDB())
|
if (!_StartDB())
|
||||||
|
{
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
///- Initialize the World
|
///- Initialize the World
|
||||||
sWorld.SetInitialWorldSettings();
|
sWorld.SetInitialWorldSettings();
|
||||||
|
|
@ -315,6 +319,7 @@ int Master::Run()
|
||||||
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip) == -1)
|
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip) == -1)
|
||||||
{
|
{
|
||||||
sLog.outError ("Failed to start network");
|
sLog.outError ("Failed to start network");
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
World::StopNow(ERROR_EXIT_CODE);
|
World::StopNow(ERROR_EXIT_CODE);
|
||||||
// go down and shutdown the server
|
// go down and shutdown the server
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -669,6 +669,12 @@ LogColors = ""
|
||||||
# Default: 1 (true)
|
# Default: 1 (true)
|
||||||
# 0 (false)
|
# 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
|
# Motd
|
||||||
# Message of the Day. Displayed at worldlogin for every user ('@' for a newline).
|
# Message of the Day. Displayed at worldlogin for every user ('@' for a newline).
|
||||||
#
|
#
|
||||||
|
|
@ -733,6 +739,7 @@ OffhandCheckAtTalentsReset = 0
|
||||||
ClientCacheVersion = 0
|
ClientCacheVersion = 0
|
||||||
Event.Announce = 0
|
Event.Announce = 0
|
||||||
BeepAtStart = 1
|
BeepAtStart = 1
|
||||||
|
WaitAtStartupError = 0
|
||||||
Motd = "Welcome to the Massive Network Game Object Server."
|
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");
|
sLog.outError("Runtime-Error: -c option requires an input argument");
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -109,6 +110,7 @@ extern int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
sLog.outError("Runtime-Error: -s option requires an input argument");
|
sLog.outError("Runtime-Error: -s option requires an input argument");
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if( strcmp(argv[c],"install") == 0)
|
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]);
|
sLog.outError("Runtime-Error: unsupported option %s",argv[c]);
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -142,6 +145,7 @@ extern int main(int argc, char **argv)
|
||||||
if (!sConfig.SetSource(cfg_file))
|
if (!sConfig.SetSource(cfg_file))
|
||||||
{
|
{
|
||||||
sLog.outError("Could not find configuration file %s.", cfg_file);
|
sLog.outError("Could not find configuration file %s.", cfg_file);
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
sLog.Initialize();
|
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(" Please check for updates, as your current default values may cause");
|
||||||
sLog.outError(" strange behavior.");
|
sLog.outError(" strange behavior.");
|
||||||
sLog.outError("*****************************************************************************");
|
sLog.outError("*****************************************************************************");
|
||||||
clock_t pause = 3000 + clock();
|
Log::WaitBeforeContinueIfNeed();
|
||||||
|
|
||||||
while (pause > clock()) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
|
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 )
|
if( !pid )
|
||||||
{
|
{
|
||||||
sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() );
|
sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() );
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,13 +190,17 @@ extern int main(int argc, char **argv)
|
||||||
|
|
||||||
///- Initialize the database connection
|
///- Initialize the database connection
|
||||||
if(!StartDB())
|
if(!StartDB())
|
||||||
|
{
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
///- Get the list of realms for the server
|
///- Get the list of realms for the server
|
||||||
sRealmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
|
sRealmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
|
||||||
if (sRealmList.size() == 0)
|
if (sRealmList.size() == 0)
|
||||||
{
|
{
|
||||||
sLog.outError("No valid realms specified.");
|
sLog.outError("No valid realms specified.");
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,6 +213,7 @@ extern int main(int argc, char **argv)
|
||||||
if ( authListenSocket.Bind(bind_ip.c_str(),rmport))
|
if ( authListenSocket.Bind(bind_ip.c_str(),rmport))
|
||||||
{
|
{
|
||||||
sLog.outError( "MaNGOS realmd can not bind to %s:%d",bind_ip.c_str(), rmport );
|
sLog.outError( "MaNGOS realmd can not bind to %s:%d",bind_ip.c_str(), rmport );
|
||||||
|
Log::WaitBeforeContinueIfNeed();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,12 @@ ConfVersion=2007062001
|
||||||
# Default: 1 (HIGH)
|
# Default: 1 (HIGH)
|
||||||
# 0 (Normal)
|
# 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
|
# RealmsStateUpdateDelay
|
||||||
# Realm list Update up delay (updated at realm list request if delay expired).
|
# Realm list Update up delay (updated at realm list request if delay expired).
|
||||||
# Default: 20
|
# Default: 20
|
||||||
|
|
@ -110,6 +116,7 @@ LogFileLevel = 0
|
||||||
LogColors = ""
|
LogColors = ""
|
||||||
UseProcessors = 0
|
UseProcessors = 0
|
||||||
ProcessPriority = 1
|
ProcessPriority = 1
|
||||||
|
WaitAtStartupError = 0
|
||||||
RealmsStateUpdateDelay = 20
|
RealmsStateUpdateDelay = 20
|
||||||
WrongPass.MaxCount = 0
|
WrongPass.MaxCount = 0
|
||||||
WrongPass.BanTime = 600
|
WrongPass.BanTime = 600
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,13 @@
|
||||||
#include "Config/ConfigEnv.h"
|
#include "Config/ConfigEnv.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "ByteBuffer.h"
|
#include "ByteBuffer.h"
|
||||||
|
#include "ProgressBar.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "ace/OS_NS_unistd.h"
|
||||||
|
|
||||||
INSTANTIATE_SINGLETON_1( Log );
|
INSTANTIATE_SINGLETON_1( Log );
|
||||||
|
|
||||||
|
|
@ -815,6 +820,29 @@ void Log::outRALog( const char * str, ... )
|
||||||
fflush(stdout);
|
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, ...)
|
void outstring_log(const char * str, ...)
|
||||||
{
|
{
|
||||||
if (!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 HasLogLevelOrHigher(LogLevel loglvl) const { return m_logLevel >= loglvl || (m_logFileLevel >= loglvl && logfile); }
|
||||||
bool IsOutCharDump() const { return m_charLog_Dump; }
|
bool IsOutCharDump() const { return m_charLog_Dump; }
|
||||||
bool IsIncludeTime() const { return m_includeTime; }
|
bool IsIncludeTime() const { return m_includeTime; }
|
||||||
|
|
||||||
|
static void WaitBeforeContinueIfNeed();
|
||||||
private:
|
private:
|
||||||
FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode);
|
FILE* openLogFile(char const* configFileName,char const* configTimeStampFlag, char const* mode);
|
||||||
FILE* openGmlogPerAccount(uint32 account);
|
FILE* openGmlogPerAccount(uint32 account);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9903"
|
#define REVISION_NR "9904"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue