This commit is contained in:
aozhiwei 2023-04-28 16:12:52 +08:00
parent e8981f141c
commit 6de09d12c6
3 changed files with 11 additions and 11 deletions

View File

@ -157,6 +157,6 @@ long long GGListener::GetSentBytesNum()
void GGListener::OnListenError(int errorid)
{
a8::XPrintf("GGListeneron_error %d\n", {errorid});
App::Instance()->terminated = true;
App::Instance()->Terminate();
exit(1);
}

View File

@ -123,8 +123,8 @@ static void SavePerfLog()
bool App::Init(int argc, char* argv[])
{
signal(SIGPIPE, SIG_IGN);
this->argc = argc;
this->argv = argv;
this->argc_ = argc;
this->argv_ = argv;
if (!ParseOpt()) {
if (node_id <= 0) {
@ -210,7 +210,7 @@ bool App::Init(int argc, char* argv[])
[] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
App::Instance()->terminated = true;
App::Instance()->terminated_ = true;
}
}
);
@ -258,7 +258,7 @@ int App::Run()
f8::UdpLog::Instance()->Info("gameserver running", {});
last_run_tick_ = a8::XGetTickCount();
int delta_time = 0;
while (!terminated) {
while (!terminated_) {
a8::tick_t begin_tick = a8::XGetTickCount();
Global::g_nowtime = time(nullptr);
QuickExecute(delta_time);
@ -464,7 +464,7 @@ void App::UnInitLog()
bool App::ParseOpt()
{
int ch = 0;
while ((ch = getopt(argc, argv, "i:t:r:f:n:")) != -1) {
while ((ch = getopt(argc_, argv_, "i:t:r:f:n:")) != -1) {
switch (ch) {
case 'n':
{

View File

@ -38,6 +38,7 @@ public:
void UnSetFlag(int flag);
long long AllocTempHeroUniId();
long long AllocTempWeaponUniId();
void Terminate() { terminated_ = true; }
private:
void QuickExecute(int delta_time);
@ -55,11 +56,6 @@ private:
bool ParseOpt();
void FreeSocketMsgQueue();
public:
int argc = 0;
char** argv = nullptr;
volatile bool terminated = false;
public:
int instance_id = 0;
int node_id = 0;
@ -81,6 +77,10 @@ private:
std::set<int> flags;
private:
int argc_ = 0;
char** argv_ = nullptr;
volatile bool terminated_ = false;
a8::uuid::SnowFlake uuid_;
long long last_run_tick_ = 0;