[IOT-2189] Fix dos transition
authorDan Mihai <Daniel.Mihai@microsoft.com>
Tue, 2 May 2017 22:11:07 +0000 (15:11 -0700)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Thu, 4 May 2017 20:47:23 +0000 (20:47 +0000)
Also, improve logging and add failed assert for inconsistent state of
the SVR.

Change-Id: Id18916c88a3e5a3caf769d3a17069e670db522ef
Signed-off-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19549
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
resource/csdk/security/src/deviceonboardingstate.c

index cfbdd6c..625d1b3 100644 (file)
@@ -433,6 +433,8 @@ static bool EnterSRESET()
     // Set pstat.dos to SRESET
     VERIFY_SUCCESS(TAG, OC_STACK_OK == SetPstatDosS(DOS_SRESET), ERROR);
 
+    ret = true;
+
 exit:
     OIC_LOG_V(DEBUG, TAG, "%s: returning %s.", __func__, ret?"true":"false");
     return ret;
@@ -575,21 +577,21 @@ OCStackResult SetDosState(const OicSecDeviceOnboardingState_t desiredState)
             switch (stateChangeResult)
             {
                 case OC_STACK_OK:
-                OIC_LOG_V(INFO, TAG, "%s: DOS state changed SUCCESSFULLY from %d to %d.", \
+                OIC_LOG_V(INFO, TAG, "%s: DOS state changed SUCCESSFULLY from %d to %d.",
                     __func__, oldState, desiredState);
                 ret = OC_STACK_OK;
                 break;
 
                 case OC_STACK_FORBIDDEN_REQ:
-                OIC_LOG_V(WARNING, TAG, "%s: DOS state change change from %d to %d NOT ALLOWED.", \
+                OIC_LOG_V(WARNING, TAG, "%s: DOS state change change from %d to %d NOT ALLOWED.",
                     __func__, oldState, desiredState);
                 ret = OC_STACK_FORBIDDEN_REQ;
                 break;
 
                 case OC_STACK_INTERNAL_SERVER_ERROR:
                 default:
-                OIC_LOG_V(ERROR, TAG, "%s: DOS state change change from %d to %d FAILED. \
-                    Internal error - SVRs may be in bad state.", \
+                OIC_LOG_V(ERROR, TAG, "%s: DOS state change change from %d to %d FAILED."
+                    " Internal error - SVRs may be in bad state.",
                     __func__, oldState, desiredState);
                 ret = OC_STACK_INTERNAL_SERVER_ERROR;
                 break;