1
This commit is contained in:
parent
e8981f141c
commit
6de09d12c6
@ -157,6 +157,6 @@ long long GGListener::GetSentBytesNum()
|
|||||||
void GGListener::OnListenError(int errorid)
|
void GGListener::OnListenError(int errorid)
|
||||||
{
|
{
|
||||||
a8::XPrintf("GGListeneron_error %d\n", {errorid});
|
a8::XPrintf("GGListeneron_error %d\n", {errorid});
|
||||||
App::Instance()->terminated = true;
|
App::Instance()->Terminate();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -123,8 +123,8 @@ static void SavePerfLog()
|
|||||||
bool App::Init(int argc, char* argv[])
|
bool App::Init(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
this->argc = argc;
|
this->argc_ = argc;
|
||||||
this->argv = argv;
|
this->argv_ = argv;
|
||||||
|
|
||||||
if (!ParseOpt()) {
|
if (!ParseOpt()) {
|
||||||
if (node_id <= 0) {
|
if (node_id <= 0) {
|
||||||
@ -210,7 +210,7 @@ bool App::Init(int argc, char* argv[])
|
|||||||
[] (int event, const a8::Args* args)
|
[] (int event, const a8::Args* args)
|
||||||
{
|
{
|
||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
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", {});
|
f8::UdpLog::Instance()->Info("gameserver running", {});
|
||||||
last_run_tick_ = a8::XGetTickCount();
|
last_run_tick_ = a8::XGetTickCount();
|
||||||
int delta_time = 0;
|
int delta_time = 0;
|
||||||
while (!terminated) {
|
while (!terminated_) {
|
||||||
a8::tick_t begin_tick = a8::XGetTickCount();
|
a8::tick_t begin_tick = a8::XGetTickCount();
|
||||||
Global::g_nowtime = time(nullptr);
|
Global::g_nowtime = time(nullptr);
|
||||||
QuickExecute(delta_time);
|
QuickExecute(delta_time);
|
||||||
@ -464,7 +464,7 @@ void App::UnInitLog()
|
|||||||
bool App::ParseOpt()
|
bool App::ParseOpt()
|
||||||
{
|
{
|
||||||
int ch = 0;
|
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) {
|
switch (ch) {
|
||||||
case 'n':
|
case 'n':
|
||||||
{
|
{
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
void UnSetFlag(int flag);
|
void UnSetFlag(int flag);
|
||||||
long long AllocTempHeroUniId();
|
long long AllocTempHeroUniId();
|
||||||
long long AllocTempWeaponUniId();
|
long long AllocTempWeaponUniId();
|
||||||
|
void Terminate() { terminated_ = true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void QuickExecute(int delta_time);
|
void QuickExecute(int delta_time);
|
||||||
@ -55,11 +56,6 @@ private:
|
|||||||
bool ParseOpt();
|
bool ParseOpt();
|
||||||
void FreeSocketMsgQueue();
|
void FreeSocketMsgQueue();
|
||||||
|
|
||||||
public:
|
|
||||||
int argc = 0;
|
|
||||||
char** argv = nullptr;
|
|
||||||
volatile bool terminated = false;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int instance_id = 0;
|
int instance_id = 0;
|
||||||
int node_id = 0;
|
int node_id = 0;
|
||||||
@ -81,6 +77,10 @@ private:
|
|||||||
std::set<int> flags;
|
std::set<int> flags;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int argc_ = 0;
|
||||||
|
char** argv_ = nullptr;
|
||||||
|
volatile bool terminated_ = false;
|
||||||
|
|
||||||
a8::uuid::SnowFlake uuid_;
|
a8::uuid::SnowFlake uuid_;
|
||||||
|
|
||||||
long long last_run_tick_ = 0;
|
long long last_run_tick_ = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user