return "ERR: scan already running" on scan command when another scan is still running
This commit is contained in:
@@ -929,6 +929,9 @@ void BusHandler::receiveCompleted() {
|
||||
}
|
||||
|
||||
result_t BusHandler::startScan(bool full) {
|
||||
if (m_runningScans > 0) {
|
||||
return RESULT_ERR_DUPLICATE;
|
||||
}
|
||||
deque<Message*> messages = m_messages->findAll("scan", "", true);
|
||||
for (deque<Message*>::iterator it = messages.begin(); it < messages.end(); it++) {
|
||||
Message* message = *it;
|
||||
|
||||
@@ -1157,6 +1157,9 @@ string MainLoop::executeGrab(vector<string> &args) {
|
||||
string MainLoop::executeScan(vector<string> &args) {
|
||||
if (args.size() == 1) {
|
||||
result_t result = m_busHandler->startScan();
|
||||
if (result == RESULT_ERR_DUPLICATE) {
|
||||
return "ERR: scan already running";
|
||||
}
|
||||
if (result != RESULT_OK) {
|
||||
logError(lf_main, "scan: %s", getResultCode(result));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user