Skip to content

Commit

Permalink
bugfix PikaMonitorThread (OpenAtomFoundation#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
Axlgrep authored Sep 7, 2018
1 parent 9c74498 commit 410dd2f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/pika_monitor_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ bool PikaMonitorThread::FindClient(const std::string &ip_port) {
}

bool PikaMonitorThread::ThreadClientKill(const std::string& ip_port) {
if (ip_port == "all") {
AddCronTask({TASK_KILLALL, "all"});
} else if (FindClient(ip_port)) {
AddCronTask({TASK_KILL, ip_port});
} else {
return false;
if (is_running()) {
if (ip_port == "all") {
AddCronTask({TASK_KILLALL, "all"});
} else if (FindClient(ip_port)) {
AddCronTask({TASK_KILL, ip_port});
} else {
return false;
}
}
return true;
}
Expand Down Expand Up @@ -157,7 +159,7 @@ void* PikaMonitorThread::ThreadMain() {
task = cron_tasks_.front();
cron_tasks_.pop();
RemoveMonitorClient(task.ip_port);
if (TASK_KILLALL) {
if (task.task == TASK_KILLALL) {
std::queue<MonitorCronTask> empty_queue;
cron_tasks_.swap(empty_queue);
}
Expand Down

0 comments on commit 410dd2f

Please sign in to comment.