From 43e31d433e7a8572e7f576b64eac394b299d6355 Mon Sep 17 00:00:00 2001 From: Amit Date: Wed, 7 Mar 2018 17:08:24 +0530 Subject: [PATCH] Update Snapshot(2018-03-07) Change-Id: I79678d132217d7056f146a899e1768fb6d27e45a Signed-off-by: Amit --- packaging/snapshot_history.txt | 6 ++++++ .../src/adapter_util/ca_adapter_net_ssl.c | 1 - .../src/bt_le_adapter/tizen/caleserver_vd.c | 21 +++++---------------- .../connectivity/src/bt_le_adapter/tizen/caleutil.c | 19 +++++++++++++++++++ .../connectivity/src/bt_le_adapter/tizen/caleutil.h | 11 +++++++++++ resource/csdk/stack/src/ocstack.c | 5 +++++ .../primitiveResource/src/RCSResourceAttributes.cpp | 2 +- 7 files changed, 47 insertions(+), 18 deletions(-) diff --git a/packaging/snapshot_history.txt b/packaging/snapshot_history.txt index 5ebc477..fee8171 100755 --- a/packaging/snapshot_history.txt +++ b/packaging/snapshot_history.txt @@ -1,3 +1,9 @@ +http://suprem.sec.samsung.net/jira/browse/CONPRO-1247 + +commit_info_2018-03-07.txt + +commit_id: 2a37bbe4849a4d147ed4a7e148b78ab40eb181aa +---------------------------------------------------------------------------------------------------------------------------------- http://suprem.sec.samsung.net/jira/browse/CONPRO-1243 commit_info_2018-02-28.txt diff --git a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c index 6dd925a..0c9e88a 100644 --- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c +++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c @@ -1713,7 +1713,6 @@ static void SetupCipher(mbedtls_ssl_config * config, CATransportAdapter_t adapte // Add PSK ciphersuite if (true == g_caSslContext->cipherFlag[0] && - SSL_CIPHER_MAX != g_caSslContext->cipher && MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 != tlsCipher[g_caSslContext->cipher][0]) { g_cipherSuitesList[index] = MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256; diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver_vd.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver_vd.c index 83acadc..cc6f208 100755 --- a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver_vd.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleserver_vd.c @@ -121,11 +121,6 @@ static LEClientInfoList *g_LEClientList = NULL; */ static oc_mutex g_LEClientListMutex = NULL; -/** - * State of connect state - */ -static bool g_LEConnectedState = false; - void CALEGattServerConnectionStateChanged(bool connected, const char *remoteAddress) { VERIFY_NON_NULL_VOID(remoteAddress, TAG, "remote address"); @@ -134,7 +129,6 @@ void CALEGattServerConnectionStateChanged(bool connected, const char *remoteAddr if (connected) { OIC_LOG_V(DEBUG, TAG, "Connected to [%s]", remoteAddress); - g_LEConnectedState = true; char *addr = OICStrdup(remoteAddress); oc_mutex_lock(g_LEClientListMutex); res = CAAddLEClientInfoToList(&g_LEClientList, addr); @@ -161,7 +155,6 @@ void CALEGattServerConnectionStateChanged(bool connected, const char *remoteAddr else { OIC_LOG_V(DEBUG, TAG, "Disconnected from [%s]", remoteAddress); - g_LEConnectedState = false; oc_mutex_lock(g_LEClientListMutex); CARemoveLEClientInfoFromList(&g_LEClientList, remoteAddress); oc_mutex_unlock(g_LEClientListMutex); @@ -911,12 +904,15 @@ CAResult_t CAUpdateCharacteristicsToGattClient(const char *address, const uint8_ oc_mutex_lock(g_leCharacteristicMutex); - if (!g_LEConnectedState) + oc_mutex_lock(g_LEClientListMutex); + if (CA_STATUS_FAILED == CAIsLEClientInfoInList(g_LEClientList, address)) { - OIC_LOG(ERROR, TAG, "g_LEConnectedState is false"); + OIC_LOG_V(ERROR, TAG, "%s device is not connected", address); + oc_mutex_unlock(g_LEClientListMutex); oc_mutex_unlock(g_leCharacteristicMutex); return CA_STATUS_FAILED; } + oc_mutex_unlock(g_LEClientListMutex); if (NULL == g_gattReadCharPath) { @@ -970,13 +966,6 @@ CAResult_t CAUpdateCharacteristicsToAllGattClients(const uint8_t *charValue, uin oc_mutex_lock(g_leCharacteristicMutex); - if (!g_LEConnectedState) - { - OIC_LOG(ERROR, TAG, "g_LEConnectedState is false"); - oc_mutex_unlock(g_leCharacteristicMutex); - return CA_STATUS_FAILED; - } - if (NULL == g_gattReadCharPath) { OIC_LOG(ERROR, TAG, "g_gattReadCharPath is NULL"); diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.c index ae02a49..d64c925 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.c @@ -267,6 +267,25 @@ CAResult_t CAAddLEClientInfoToList(LEClientInfoList **clientList, return CA_STATUS_OK; } +CAResult_t CAIsLEClientInfoInList(LEClientInfoList *clientList, + const char *clientAddress) +{ + OIC_LOG(DEBUG, TAG, "IN"); + + LEClientInfoList *temp = clientList; + while (temp) + { + if (!strcasecmp(temp->remoteAddress, clientAddress)) + { + return CA_STATUS_OK; + } + temp = temp->next; + } + + OIC_LOG(DEBUG, TAG, "OUT"); + return CA_STATUS_FAILED; +} + void CARemoveLEClientInfoFromList(LEClientInfoList **clientList, const char *clientAddress) { diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.h b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.h index ed51602..3b3daa0 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.h +++ b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleutil.h @@ -187,6 +187,17 @@ void CARemoveLEClientInfoFromList(LEClientInfoList **clientList, const char *clientAddress); /** + * Used to check if client address is present in the list. + * + * @param[in] clientList Pointer to the ble client list which holds the info of list of + * clients connected by the server. + * @param[in] clientAddress Remote address to be searched in the client list. + * @return ::CA_STATUS_OK if client address is found in the list, otherwise CA_STATUS_FAILED. + */ +CAResult_t CAIsLEClientInfoInList(LEClientInfoList *clientList, + const char *clientAddress); + +/** * Used to disconnect all the clients connected to the server. * * @param[in,out] clientList Pointer to the ble client list which holds the info of list of diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index 9ad65c2..c34b2f2 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -3132,6 +3132,7 @@ OCStackResult OCDoRequest(OCDoHandle *handle, goto exit; } + cbData = NULL; // Client CB list entry now owns it token = NULL; // Client CB list entry now owns it devAddr = NULL; // Client CB list entry now owns it resourceUri = NULL; // Client CB list entry now owns it @@ -3167,6 +3168,10 @@ exit: if (result != OC_STACK_OK) { OIC_LOG(ERROR, TAG, "OCDoResource error"); + if (NULL != cbData && NULL != cbData->cd) + { + cbData->cd(cbData->context); + } FindAndDeleteClientCB(clientCB); CADestroyToken(token); if (handle) diff --git a/service/resource-encapsulation/src/common/primitiveResource/src/RCSResourceAttributes.cpp b/service/resource-encapsulation/src/common/primitiveResource/src/RCSResourceAttributes.cpp index 75e9d56..1b2d876 100644 --- a/service/resource-encapsulation/src/common/primitiveResource/src/RCSResourceAttributes.cpp +++ b/service/resource-encapsulation/src/common/primitiveResource/src/RCSResourceAttributes.cpp @@ -629,7 +629,7 @@ namespace OIC void RCSResourceAttributes::clear() noexcept { - return m_values.clear(); + m_values.clear(); } bool RCSResourceAttributes::erase(const std::string& key) -- 2.7.4