This commit is contained in:
aozhiwei 2023-04-24 14:35:37 +08:00
parent b038b27c40
commit a480c642bf
2 changed files with 9 additions and 8 deletions

View File

@ -86,8 +86,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()) {
terminated = true; terminated = true;
@ -486,7 +486,7 @@ void App::UnInitLog()
bool App::ParseOpt() bool App::ParseOpt()
{ {
int ch = 0; int ch = 0;
while ((ch = getopt(argc, argv, "n:i:f:")) != -1) { while ((ch = getopt(argc_, argv_, "n:i:f:")) != -1) {
switch (ch) { switch (ch) {
case 'n': case 'n':
{ {
@ -503,7 +503,7 @@ bool App::ParseOpt()
std::vector<std::string> strings; std::vector<std::string> strings;
a8::Split(optarg, strings, ','); a8::Split(optarg, strings, ',');
for (auto& str : strings) { for (auto& str : strings) {
flags.insert(a8::XValue(str).GetInt()); flags_.insert(a8::XValue(str).GetInt());
} }
} }
break; break;
@ -514,7 +514,7 @@ bool App::ParseOpt()
bool App::HasFlag(int flag) bool App::HasFlag(int flag)
{ {
return flags.find(flag) != flags.end(); return flags_.find(flag) != flags_.end();
} }
void App::FreeSocketMsgQueue() void App::FreeSocketMsgQueue()

View File

@ -63,16 +63,17 @@ private:
void FreeUdpMsgQueue(); void FreeUdpMsgQueue();
public: public:
int argc = 0;
char** argv = nullptr;
volatile bool terminated = false; volatile bool terminated = false;
volatile bool shutdowned = false; volatile bool shutdowned = false;
std::set<int> flags;
PerfMonitor perf; PerfMonitor perf;
private: private:
int argc_ = 0;
char** argv_ = nullptr;
int node_id_ = 0; int node_id_ = 0;
int instance_id_ = 0; int instance_id_ = 0;
std::set<int> flags_;
std::shared_ptr<a8::uuid::SnowFlake> uuid_; std::shared_ptr<a8::uuid::SnowFlake> uuid_;
std::mutex *loop_mutex_ = nullptr; std::mutex *loop_mutex_ = nullptr;