Treat invalid check_id as an error in async cancel 50/29350/2
authorLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Fri, 24 Oct 2014 15:52:32 +0000 (17:52 +0200)
committerLukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Mon, 27 Oct 2014 13:01:08 +0000 (06:01 -0700)
If check_id passed to cynara_async_cancel_request() is invalid
CYNARA_API_INVALID_PARAM will be returned.
Id is invalid when:
* was never generated by any previous call to cynara_async_create_request();
* response callback related to this id was already delivered.

Change-Id: Iaa05fe71c752aedcb5414d162fc374f37420f36d

src/client-async/logic/Logic.cpp
src/include/cynara-client-async.h

index 3a92b2c..8babbed 100644 (file)
@@ -112,7 +112,7 @@ int Logic::cancelRequest(cynara_check_id checkId) {
 
     auto it = m_checks.find(checkId);
     if (it == m_checks.end() || it->second.cancelled())
-        return CYNARA_API_SUCCESS;
+        return CYNARA_API_INVALID_PARAM;
 
     m_socketClient->appendRequest(std::make_shared<CancelRequest>(it->first));
 
index 9bed89d..536e5d7 100644 (file)
@@ -386,6 +386,8 @@ int cynara_async_process(cynara_async *p_cynara);
  * cynara_status_callback callback may be triggered to be able to send cancel to cynara.
  * cynara_response_callback callback will be triggered with with
  * cynara_async_call_cause::CYNARA_CALL_CAUSE_CANCEL as cause param.
+ * If given id is not valid (was not requested or response callback was already delivered)
+ * cynara_async_cancel_request() returns CYNARA_API_INVALID_PARAM.
  *
  * \par Sync (or) Async:
  * This is a synchronous API.