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