Fixed bug during CacheID generation in resource encapsulation.
authorAbhishek Pandey <abhi.siso@samsung.com>
Thu, 21 Jul 2016 10:00:11 +0000 (15:30 +0530)
committerAshok Babu Channa <ashok.channa@samsung.com>
Fri, 22 Jul 2016 04:43:59 +0000 (04:43 +0000)
commita3a93ebcfcba49bda6b4623bdc38e0a4f0d134ee
tree606e91d3ab2db9ecdcc1109923fb221c6af8e443
parentd7b95d123e45531ac9bb975cc098b478c3022485
Fixed bug during CacheID generation in resource encapsulation.

On calling startCaching API [RCSRemoteResourceObject.h] for different resources
one after another it is generating the same CacheID.

If we call the API at 1 second delay it is working fine; but it's better to use
a more accurate random generator. OCGetRandom() function provided by CSDK
seems to be more accurate here as it seeds each byte separately.

In this patch we have replaced rand() call with OCGetRandom().
This solves the problem in our test environment and generates unique random
numbers each time which can be used as Cache IDs.

Change-Id: I52858d6b6d149ec23df39920d8a767dd08d67d69
Signed-off-by: Abhishek Pandey <abhi.siso@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9549
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Junghyun Oh <junghyun.oh@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
service/resource-encapsulation/src/resourceCache/src/DataCache.cpp