Without proper re-entrancy, the RI Layer's C SDK should not support or try
to support more than one instance of the stack. If it does, unknown
behavior may occur. This commit eliminates this possible cause for error.
Change-Id: Ib85d29cdd2b8fa55a7415f57e8ec7e88bc164927
Signed-off-by: Joseph Morrow <joseph.l.morrow@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/749
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-by: Doug Hudson <douglas.hudson@intel.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
OCStackResult OCInit(const char *ipAddr, uint16_t port, OCMode mode)
{
+ if(stackState == OC_STACK_INITIALIZED)
+ {
+ OC_LOG(INFO, TAG, PCF("Subsequent calls to OCInit() without calling \
+ OCStop() between them are ignored."));
+ return OC_STACK_OK;
+ }
+
(void) ipAddr;
(void) port;
OCStackResult result = OC_STACK_ERROR;