[IOT-2806] improve pstat->tm logging 13/22813/2
authorNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Fri, 13 Oct 2017 01:43:35 +0000 (18:43 -0700)
committerRandeep Singh <randeep.s@samsung.com>
Tue, 17 Oct 2017 07:38:42 +0000 (07:38 +0000)
Please cherry-pick this patch and re-run TC.

Change-Id: Ic4cfd419bc11c76545e9e385993f4ae71c4bd52e
Signed-off-by: Nathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
resource/csdk/security/src/pstatresource.c

index ea9b87d..b6dbe6b 100644 (file)
@@ -580,6 +580,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
 
         cborFindResult = cbor_value_get_int(&pstatMap, &tm);
         VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Finding TM.");
+        OIC_LOG_V(INFO, TAG, "%s parsed pstat->tm = %u", __func__, (OicSecDpm_t)tm);
         pstat->tm = (OicSecDpm_t)tm;
 
         if (roParsed)
@@ -593,6 +594,8 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload,
     }
     else
     {
+        OIC_LOG_V(INFO, TAG, "%s no pstat->tm found in payload, using existing value of %u",
+            __func__, gPstat->tm);
         pstat->tm = gPstat->tm;
         cborFindResult = CborNoError;
     }
@@ -877,6 +880,7 @@ static OCEntityHandlerResult HandlePstatPostRequest(OCEntityHandlerRequest *ehRe
             gPstat->om = pstat->om;
 
             // update tm
+            OIC_LOG_V(INFO, TAG, "%s setting gPstat->tm = %u", __func__, pstat->tm);
             gPstat->tm = pstat->tm;
 
             // update rownerID
@@ -1064,6 +1068,8 @@ void RestorePstatToInitState()
         gPstat->dos.state = DOS_RFOTM;
         gPstat->dos.pending = false;
         gPstat->cm = (OicSecDpm_t)(gPstat->cm | TAKE_OWNER);
+        OIC_LOG_V(INFO, TAG, "%s setting gPstat->tm = %u",
+            __func__, (OicSecDpm_t)(gPstat->tm & (~TAKE_OWNER)));
         gPstat->tm = (OicSecDpm_t)(gPstat->tm & (~TAKE_OWNER));
         gPstat->om = SINGLE_SERVICE_CLIENT_DRIVEN;
         if(gPstat->sm && 0 < gPstat->smLen)
@@ -1220,6 +1226,7 @@ OCStackResult SetPstatTm(const OicSecDpm_t tm)
 {
     if (gPstat)
     {
+        OIC_LOG_V(INFO, TAG, "%s setting gPstat->tm = %u", __func__, tm);
         gPstat->tm = tm;
         return OC_STACK_OK;
     }