diff --git a/src/controller/CommissioneeDeviceProxy.cpp b/src/controller/CommissioneeDeviceProxy.cpp index 024a7c5167d8f9..74b0231e3a7401 100644 --- a/src/controller/CommissioneeDeviceProxy.cpp +++ b/src/controller/CommissioneeDeviceProxy.cpp @@ -138,11 +138,12 @@ CHIP_ERROR CommissioneeDeviceProxy::SetConnected() { return CHIP_ERROR_INCORRECT_STATE; } + mState = ConnectionState::SecureConnected; bool _didLoad; CHIP_ERROR err = LoadSecureSessionParametersIfNeeded(_didLoad); - if (err == CHIP_NO_ERROR) + if (err != CHIP_NO_ERROR) { - mState = ConnectionState::SecureConnected; + mState = ConnectionState::NotConnected; } return err; }