When retransmission fails(time out), the data in BWT list has to be removed.
Change-Id: Ic94b5f2c8c25604b237383939f31bd30412bb1f9
Signed-off-by: Jaewook Jung <jw0213.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/7901
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jon@joncruz.org>
CAResult_t CARemoveAllBlockDataFromList();
/**
- * Check if data exist in block-wise transfer list.
- * @param[in] blockID ID set of CABlockData.
- * @return true or false.
+ * Find the block data with seed info and remove it from block-wise transfer list.
+ * @param[in] token token of the message.
+ * @param[in] tokenLength token length of the message.
+ * @param[in] portNumber port.
+ * @return ::CASTATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
*/
-bool CAIsBlockDataInList(const CABlockDataID_t *blockID);
-
+CAResult_t CARemoveBlockDataFromListWithSeed(const CAToken_t token, uint8_t tokenLength,
+ uint16_t portNumber);
#ifdef __cplusplus
} /* extern "C" */
OIC_LOG_V(DEBUG, TAG, "block option-szx : %d", block->szx);
}
+
+CAResult_t CARemoveBlockDataFromListWithSeed(const CAToken_t token, uint8_t tokenLength,
+ uint16_t portNumber)
+{
+ CABlockDataID_t* blockDataID = CACreateBlockDatablockId(token, tokenLength, portNumber);
+ if (NULL == blockDataID || blockDataID->idLength < 1)
+ {
+ OIC_LOG(ERROR, TAG, "blockId is null");
+ CADestroyBlockID(blockDataID);
+ return CA_STATUS_FAILED;
+ }
+
+ CAResult_t res = CA_STATUS_OK;
+
+ if (NULL != CAGetBlockDataFromBlockDataList(blockDataID))
+ {
+ res = CARemoveBlockDataFromList(blockDataID);
+ if (CA_STATUS_OK != res)
+ {
+ OIC_LOG(ERROR, TAG, "CARemoveBlockDataFromList failed");
+ }
+ }
+
+ CADestroyBlockID(blockDataID);
+
+ return res;
+}
cadata->requestInfo = NULL;
cadata->responseInfo = resInfo;
+#ifdef WITH_BWT
+ if (CAIsSupportedBlockwiseTransfer(endpoint->adapter))
+ {
+ res = CARemoveBlockDataFromListWithSeed(resInfo->info.token, resInfo->info.tokenLength,
+ endpoint->port);
+ if (CA_STATUS_OK != res)
+ {
+ OIC_LOG(ERROR, TAG, "CARemoveBlockDataFromListWithSeed failed");
+ }
+ }
+#endif // WITH_BWT
+
#ifdef SINGLE_THREAD
CAProcessReceivedData(cadata);
#else