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

View File

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