if (ret != ASYNC_EVENT_START)
ThrowExc(ret, "Error on async scan. ret: " << ret);
- bool isDone = false;
-
DEBUG("loop for waiting server event start!!");
- while (!isDone) {
+ while (true) {
auto event = this->m_handle->revent<int>();
DEBUG("event received: " << event);
case ASYNC_EVENT_COMPLETE: {
DEBUG("Async operation completed");
- isDone = true;
- break;
+ return;
+ }
+
+ case ASYNC_EVENT_CANCEL: {
+ ThrowExcInfo(ASYNC_EVENT_CANCEL, "Async operation cancelled!");
}
default:
#include "common/audit/logger.h"
#include "common/binary-queue.h"
+#include "common/async-protocol.h"
+
#include <csr-error.h>
namespace Csr {
try {
return func();
} catch (const Exception &e) {
- ERROR("Exception caught. code: " << e.error() << " message: " << e.what());
+ if (e.error() == ASYNC_EVENT_CANCEL)
+ INFO("Async operation cancel exception: " << e.what());
+ else
+ ERROR("Exception caught. code: " << e.error() << " message: " << e.what());
+
return BinaryQueue::Serialize(e.error()).pop();
} catch (const std::invalid_argument &e) {
ERROR("Invalid argument: " << e.what());