_lock_and_wait();
#else
- if (OCRDPublish(NULL, uri, CT_ADAPTER_TCP|CT_IP_USE_V4,
- res_handle, 2,
-// &cb_data, OIC_RD_PUBLISH_TTL, OC_LOW_QOS) != OC_STACK_OK) {
- &cb_data, OC_LOW_QOS) != OC_STACK_OK) {
+
+ int ocResult = OC_STACK_OK;
+ ocResult = OCRDPublish(NULL, uri, (CT_ADAPTER_TCP | CT_IP_USE_V4), NULL, 0, &cb_data, OC_LOW_QOS);
+ if (ocResult != OC_STACK_OK) {
+ FWR_LOGD("Publish Resource with null handle failed [%d]", ocResult);
+ return -1;
+ }
+ _lock_and_wait();
+
+ ocResult = (OCRDPublish(NULL, uri, CT_ADAPTER_TCP|CT_IP_USE_V4, res_handle, 2,
+// &cb_data, OIC_RD_PUBLISH_TTL, OC_LOW_QOS) != OC_STACK_OK)
+ &cb_data, OC_LOW_QOS) != OC_STACK_OK);
+ if (ocResult != OC_STACK_OK) {
FWR_LOGD("OCRDPublish() failed\n");
return -1;
}