Commit cb3e0d48 authored by captainwong's avatar captainwong

server_demo_libevent 支持按下Q发送1798查询主机类型

parent ad767169
...@@ -67,7 +67,7 @@ int disable_data_print = 0; ...@@ -67,7 +67,7 @@ int disable_data_print = 0;
void op_usage() void op_usage()
{ {
printf("Press A for Arm, D for Disarm, E for Emergency, Q for Quit\n"); printf("Press A for Arm, D for Disarm, E for Emergency, T for query machine type, Q for Quit\n");
} }
void usage(const char* name) void usage(const char* name)
...@@ -376,6 +376,13 @@ int main(int argc, char** argv) ...@@ -376,6 +376,13 @@ int main(int argc, char** argv)
threads_to_handled_event = thread_count; threads_to_handled_event = thread_count;
} }
fire_command(); fire_command();
} else if (cmd == 't' || cmd == 'T') {
{
std::lock_guard<std::mutex> lg(mutex);
events.push_back(EVENT_WHAT_IS_YOUR_TYPE);
threads_to_handled_event = thread_count;
}
fire_command();
} else if (cmd == '\r' || cmd == '\n') { } else if (cmd == '\r' || cmd == '\n') {
} else if (cmd == 'q' || cmd == 'Q') { } else if (cmd == 'q' || cmd == 'Q') {
timeval tv{ 0, 1000 }; timeval tv{ 0, 1000 };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment