Make cleanup functions return 'void' (#19870)
Destructors, Shutdown functions, and other cleanup code should be
declared with a 'void' return type as typically there is nothing that
can be done in the caller when an error is returned.
This removes the error return from such functions throughought Matter.
This transformation is straightforward in every case, and semantic
preserving in almost every case (broken semantics such as leaking memory
or leaving objects in an inconsistent state are not necessarily
preserved); it's rare for shutdown functions to actually return errors,
and also rare for callers to check for them.
Removing the threat of errors from cleanup functions simplifies control
flow in shutdown paths. It also facilitates shutdown from destructors
which is the typical C++ resource management paradigm ("RAII"), as
destructors have no return type.
Some functions had error cases that only occured when there was nothing
to do (e.g. not fully initialized returning 'invalid state'); these are
removed. The postcondition already holds in these cases, and maintaining
a precondition regarding the state would impose duplicative bookkeeping
in client code to track it without any real upside.
This changes a fair number of APIs, but the changes are easy to
accomodate as it is simply a matter of removing dead code (much of
which was already dead; one class even included the note
@return #CHIP_NO_ERROR unconditionally.
as documentation that an error was not actually possible).
diff --git a/src/access/AccessControl.cpp b/src/access/AccessControl.cpp
index 58789cc..22b8dab 100644
--- a/src/access/AccessControl.cpp
+++ b/src/access/AccessControl.cpp
@@ -184,13 +184,12 @@
return retval;
}
-CHIP_ERROR AccessControl::Finish()
+void AccessControl::Finish()
{
- VerifyOrReturnError(IsInitialized(), CHIP_ERROR_INCORRECT_STATE);
+ VerifyOrReturn(IsInitialized());
ChipLogProgress(DataManagement, "AccessControl: finishing");
- CHIP_ERROR retval = mDelegate->Finish();
- mDelegate = nullptr;
- return retval;
+ mDelegate->Finish();
+ mDelegate = nullptr;
}
CHIP_ERROR AccessControl::CreateEntry(const SubjectDescriptor * subjectDescriptor, FabricIndex fabric, size_t * index,
diff --git a/src/access/AccessControl.h b/src/access/AccessControl.h
index 158e0f5..d4dfddd 100644
--- a/src/access/AccessControl.h
+++ b/src/access/AccessControl.h
@@ -342,7 +342,7 @@
virtual void Release() {}
virtual CHIP_ERROR Init() { return CHIP_NO_ERROR; }
- virtual CHIP_ERROR Finish() { return CHIP_NO_ERROR; }
+ virtual void Finish() {}
// Capabilities
virtual CHIP_ERROR GetMaxEntriesPerFabric(size_t & value) const
@@ -430,7 +430,7 @@
/**
* Deinitialize the access control module. Must be called when finished.
*/
- CHIP_ERROR Finish();
+ void Finish();
// Capabilities
CHIP_ERROR GetMaxEntriesPerFabric(size_t & value) const
diff --git a/src/access/examples/ExampleAccessControlDelegate.cpp b/src/access/examples/ExampleAccessControlDelegate.cpp
index d56d96b..fc1c1b7 100644
--- a/src/access/examples/ExampleAccessControlDelegate.cpp
+++ b/src/access/examples/ExampleAccessControlDelegate.cpp
@@ -965,11 +965,7 @@
return CHIP_NO_ERROR;
}
- CHIP_ERROR Finish() override
- {
- ChipLogProgress(DataManagement, "Examples::AccessControlDelegate::Finish");
- return CHIP_NO_ERROR;
- }
+ void Finish() override { ChipLogProgress(DataManagement, "Examples::AccessControlDelegate::Finish"); }
CHIP_ERROR GetMaxEntriesPerFabric(size_t & value) const override
{
diff --git a/src/access/examples/PermissiveAccessControlDelegate.cpp b/src/access/examples/PermissiveAccessControlDelegate.cpp
index 55adb13..6b4b3cb 100644
--- a/src/access/examples/PermissiveAccessControlDelegate.cpp
+++ b/src/access/examples/PermissiveAccessControlDelegate.cpp
@@ -31,7 +31,7 @@
{
public:
CHIP_ERROR Init() override { return CHIP_NO_ERROR; }
- CHIP_ERROR Finish() override { return CHIP_NO_ERROR; }
+ void Finish() override {}
// Capabilities
CHIP_ERROR GetMaxEntryCount(size_t & value) const override
diff --git a/src/app/DeviceProxy.h b/src/app/DeviceProxy.h
index 2c0d26d..ce9a390 100644
--- a/src/app/DeviceProxy.h
+++ b/src/app/DeviceProxy.h
@@ -43,11 +43,11 @@
/**
* Mark any open session with the device as expired.
*/
- virtual CHIP_ERROR Disconnect() = 0;
+ virtual void Disconnect() = 0;
virtual NodeId GetDeviceId() const = 0;
- virtual CHIP_ERROR ShutdownSubscriptions() { return CHIP_ERROR_NOT_IMPLEMENTED; }
+ virtual void ShutdownSubscriptions() = 0;
virtual CHIP_ERROR SendCommands(app::CommandSender * commandObj, chip::Optional<System::Clock::Timeout> timeout = NullOptional);
diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp
index 2a16f9b..bfffe29 100644
--- a/src/app/InteractionModelEngine.cpp
+++ b/src/app/InteractionModelEngine.cpp
@@ -231,7 +231,7 @@
return CHIP_ERROR_KEY_NOT_FOUND;
}
-CHIP_ERROR InteractionModelEngine::ShutdownSubscriptions(FabricIndex aFabricIndex, NodeId aPeerNodeId)
+void InteractionModelEngine::ShutdownSubscriptions(FabricIndex aFabricIndex, NodeId aPeerNodeId)
{
for (auto * readClient = mpActiveReadClientList; readClient != nullptr; readClient = readClient->GetNextClient())
{
@@ -241,8 +241,6 @@
readClient->Close(CHIP_NO_ERROR);
}
}
-
- return CHIP_NO_ERROR;
}
void InteractionModelEngine::OnDone(CommandHandler & apCommandObj)
diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h
index 42c094f..c3a5248 100644
--- a/src/app/InteractionModelEngine.h
+++ b/src/app/InteractionModelEngine.h
@@ -124,11 +124,8 @@
/**
* Tears down active subscriptions for a given peer node ID.
- *
- * @retval #CHIP_ERROR_KEY_NOT_FOUND If no active subscription is found.
- * @retval #CHIP_NO_ERROR On success.
*/
- CHIP_ERROR ShutdownSubscriptions(FabricIndex aFabricIndex, NodeId aPeerNodeId);
+ void ShutdownSubscriptions(FabricIndex aFabricIndex, NodeId aPeerNodeId);
/**
* Expire active transactions and release related objects for the given fabric index.
@@ -392,9 +389,6 @@
bool HasActiveRead();
- CHIP_ERROR ShutdownExistingSubscriptionsIfNeeded(Messaging::ExchangeContext * apExchangeContext,
- System::PacketBufferHandle && aPayload);
-
inline size_t GetPathPoolCapacityForReads() const
{
#if CONFIG_BUILD_FOR_HOST_UNIT_TEST
diff --git a/src/app/OperationalDeviceProxy.cpp b/src/app/OperationalDeviceProxy.cpp
index fad25a6..92651af 100644
--- a/src/app/OperationalDeviceProxy.cpp
+++ b/src/app/OperationalDeviceProxy.cpp
@@ -313,9 +313,9 @@
// Do not touch this instance anymore; it might have been destroyed by a callback.
}
-CHIP_ERROR OperationalDeviceProxy::Disconnect()
+void OperationalDeviceProxy::Disconnect()
{
- ReturnErrorCodeIf(mState != State::SecureConnected, CHIP_ERROR_INCORRECT_STATE);
+ VerifyOrReturn(mState == State::SecureConnected);
if (mSecureSession)
{
@@ -331,7 +331,6 @@
mSecureSession.Release();
MoveToState(State::HasAddress);
- return CHIP_NO_ERROR;
}
void OperationalDeviceProxy::CleanupCASEClient()
@@ -358,9 +357,9 @@
// TODO: establish a new session
}
-CHIP_ERROR OperationalDeviceProxy::ShutdownSubscriptions()
+void OperationalDeviceProxy::ShutdownSubscriptions()
{
- return app::InteractionModelEngine::GetInstance()->ShutdownSubscriptions(mFabricIndex, GetDeviceId());
+ app::InteractionModelEngine::GetInstance()->ShutdownSubscriptions(mFabricIndex, GetDeviceId());
}
OperationalDeviceProxy::~OperationalDeviceProxy()
diff --git a/src/app/OperationalDeviceProxy.h b/src/app/OperationalDeviceProxy.h
index 1681816..3adf96b 100644
--- a/src/app/OperationalDeviceProxy.h
+++ b/src/app/OperationalDeviceProxy.h
@@ -167,13 +167,13 @@
/**
* Mark any open session with the device as expired.
*/
- CHIP_ERROR Disconnect() override;
+ void Disconnect() override;
NodeId GetDeviceId() const override { return mPeerId.GetNodeId(); }
PeerId GetPeerId() const { return mPeerId; }
- CHIP_ERROR ShutdownSubscriptions() override;
+ void ShutdownSubscriptions() override;
Messaging::ExchangeManager * GetExchangeManager() const override { return mInitParams.exchangeMgr; }
diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp
index 599522f..1b22b34 100644
--- a/src/app/clusters/network-commissioning/network-commissioning.cpp
+++ b/src/app/clusters/network-commissioning/network-commissioning.cpp
@@ -70,10 +70,9 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR Instance::Shutdown()
+void Instance::Shutdown()
{
- ReturnErrorOnFailure(mpBaseDriver->Shutdown());
- return CHIP_NO_ERROR;
+ mpBaseDriver->Shutdown();
}
void Instance::InvokeCommand(HandlerContext & ctxt)
diff --git a/src/app/clusters/network-commissioning/network-commissioning.h b/src/app/clusters/network-commissioning/network-commissioning.h
index fddd410..5ec03e2 100644
--- a/src/app/clusters/network-commissioning/network-commissioning.h
+++ b/src/app/clusters/network-commissioning/network-commissioning.h
@@ -46,7 +46,7 @@
* Register will register the network commissioning instance to the attribute and command dispatching route.
*/
CHIP_ERROR Init();
- CHIP_ERROR Shutdown();
+ void Shutdown();
// CommandHandlerInterface
void InvokeCommand(HandlerContext & ctx) override;
diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp
index 0db0f96..0ea320d 100644
--- a/src/app/server/Server.cpp
+++ b/src/app/server/Server.cpp
@@ -407,11 +407,7 @@
chip::Dnssd::Resolver::Instance().Shutdown();
chip::app::InteractionModelEngine::GetInstance()->Shutdown();
mMessageCounterManager.Shutdown();
- CHIP_ERROR err = mExchangeMgr.Shutdown();
- if (err != CHIP_NO_ERROR)
- {
- ChipLogError(AppServer, "Exchange Mgr shutdown: %" CHIP_ERROR_FORMAT, err.Format());
- }
+ mExchangeMgr.Shutdown();
mSessions.Shutdown();
mTransports.Close();
mAccessControl.Finish();
diff --git a/src/app/tests/AppTestContext.cpp b/src/app/tests/AppTestContext.cpp
index 435c16c..1199537 100644
--- a/src/app/tests/AppTestContext.cpp
+++ b/src/app/tests/AppTestContext.cpp
@@ -49,14 +49,12 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR AppContext::Shutdown()
+void AppContext::Shutdown()
{
- ReturnErrorOnFailure(Access::GetAccessControl().Finish());
+ Access::GetAccessControl().Finish();
chip::app::InteractionModelEngine::GetInstance()->Shutdown();
- ReturnErrorOnFailure(Super::Shutdown());
-
- return CHIP_NO_ERROR;
+ Super::Shutdown();
}
} // namespace Test
diff --git a/src/app/tests/AppTestContext.h b/src/app/tests/AppTestContext.h
index fa7d76f..167ff8a 100644
--- a/src/app/tests/AppTestContext.h
+++ b/src/app/tests/AppTestContext.h
@@ -33,7 +33,7 @@
CHIP_ERROR Init() override;
// Shutdown all layers, finalize operations
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
};
} // namespace Test
diff --git a/src/ble/BleLayer.cpp b/src/ble/BleLayer.cpp
index d634e19..6242704 100644
--- a/src/ble/BleLayer.cpp
+++ b/src/ble/BleLayer.cpp
@@ -298,13 +298,13 @@
return Init(platformDelegate, nullptr, appDelegate, systemLayer);
}
-CHIP_ERROR BleLayer::Shutdown()
+void BleLayer::Shutdown()
{
mState = kState_NotInitialized;
- return CloseAllBleConnections();
+ CloseAllBleConnections();
}
-CHIP_ERROR BleLayer::CloseAllBleConnections()
+void BleLayer::CloseAllBleConnections()
{
// Close and free all BLE end points.
for (size_t i = 0; i < BLE_LAYER_NUM_BLE_ENDPOINTS; i++)
@@ -329,10 +329,9 @@
}
}
}
- return CHIP_NO_ERROR;
}
-CHIP_ERROR BleLayer::CloseBleConnection(BLE_CONNECTION_OBJECT connObj)
+void BleLayer::CloseBleConnection(BLE_CONNECTION_OBJECT connObj)
{
// Close and free all BLE endpoints.
for (size_t i = 0; i < BLE_LAYER_NUM_BLE_ENDPOINTS; i++)
@@ -357,7 +356,6 @@
}
}
}
- return CHIP_NO_ERROR;
}
CHIP_ERROR BleLayer::CancelBleIncompleteConnection()
diff --git a/src/ble/BleLayer.h b/src/ble/BleLayer.h
index c7e2148..c4bc358 100644
--- a/src/ble/BleLayer.h
+++ b/src/ble/BleLayer.h
@@ -242,7 +242,7 @@
chip::System::Layer * systemLayer);
CHIP_ERROR Init(BlePlatformDelegate * platformDelegate, BleConnectionDelegate * connDelegate,
BleApplicationDelegate * appDelegate, chip::System::Layer * systemLayer);
- CHIP_ERROR Shutdown();
+ void Shutdown();
CHIP_ERROR CancelBleIncompleteConnection();
CHIP_ERROR NewBleConnectionByDiscriminator(uint16_t connDiscriminator, void * appState = nullptr,
@@ -251,8 +251,8 @@
CHIP_ERROR NewBleConnectionByObject(BLE_CONNECTION_OBJECT connObj);
CHIP_ERROR NewBleEndPoint(BLEEndPoint ** retEndPoint, BLE_CONNECTION_OBJECT connObj, BleRole role, bool autoClose);
- CHIP_ERROR CloseAllBleConnections();
- CHIP_ERROR CloseBleConnection(BLE_CONNECTION_OBJECT connObj);
+ void CloseAllBleConnections();
+ void CloseBleConnection(BLE_CONNECTION_OBJECT connObj);
/**< Platform interface functions:
diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp
index e7ab67a..258e494 100644
--- a/src/controller/CHIPDeviceController.cpp
+++ b/src/controller/CHIPDeviceController.cpp
@@ -280,9 +280,9 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR DeviceController::Shutdown()
+void DeviceController::Shutdown()
{
- VerifyOrReturnError((mState == State::Initialized) && (mSystemState != nullptr), CHIP_ERROR_INCORRECT_STATE);
+ VerifyOrReturn(mState != State::NotInitialized);
ChipLogDetail(Controller, "Shutting down the controller");
@@ -312,8 +312,6 @@
mDNSResolver.Shutdown();
mDeviceDiscoveryDelegate = nullptr;
-
- return CHIP_NO_ERROR;
}
void DeviceController::ReleaseOperationalDevice(NodeId remoteNodeId)
@@ -336,7 +334,7 @@
if (proxy->IsConnected())
{
- return proxy->Disconnect();
+ proxy->Disconnect();
}
if (proxy->IsConnecting())
@@ -456,9 +454,9 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR DeviceCommissioner::Shutdown()
+void DeviceCommissioner::Shutdown()
{
- VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE);
+ VerifyOrReturn(mState != State::NotInitialized);
ChipLogDetail(Controller, "Shutting down the commissioner");
@@ -489,7 +487,6 @@
mCommissioneeDevicePool.ReleaseAll();
DeviceController::Shutdown();
- return CHIP_NO_ERROR;
}
CommissioneeDeviceProxy * DeviceCommissioner::FindCommissioneeDevice(NodeId id)
@@ -1380,12 +1377,12 @@
}
#endif // CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE
-CHIP_ERROR DeviceCommissioner::CloseBleConnection()
+void DeviceCommissioner::CloseBleConnection()
{
// It is fine since we can only commission one device at the same time.
// We should be able to distinguish different BLE connections if we want
// to commission multiple devices at the same time over BLE.
- return mSystemState->BleLayer()->CloseAllBleConnections();
+ mSystemState->BleLayer()->CloseAllBleConnections();
}
#endif
diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h
index c1664d6..973b497 100644
--- a/src/controller/CHIPDeviceController.h
+++ b/src/controller/CHIPDeviceController.h
@@ -153,7 +153,7 @@
* This will also not stop the CHIP event queue / thread (if one exists). Consumers are expected to
* ensure this happened before calling this method.
*/
- virtual CHIP_ERROR Shutdown();
+ virtual void Shutdown();
SessionManager * SessionMgr()
{
@@ -408,7 +408,7 @@
*
* Please see implementation for more details.
*/
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
// ----- Connection Management -----
/**
@@ -582,9 +582,8 @@
* Once we have finished all commissioning work, the Controller should close the BLE
* connection to the device and establish CASE session / another PASE session to the device
* if needed.
- * @return CHIP_ERROR The return status
*/
- CHIP_ERROR CloseBleConnection();
+ void CloseBleConnection();
#endif
/**
* @brief
diff --git a/src/controller/CHIPDeviceControllerFactory.cpp b/src/controller/CHIPDeviceControllerFactory.cpp
index 86fe802..ef9aaaa 100644
--- a/src/controller/CHIPDeviceControllerFactory.cpp
+++ b/src/controller/CHIPDeviceControllerFactory.cpp
@@ -422,8 +422,7 @@
// Consumers are expected to call PlaformMgr().StopEventLoopTask() before calling
// DeviceController::Shutdown() in the CONFIG_DEVICE_LAYER configuration
//
- CHIP_ERROR error = DeviceLayer::PlatformMgr().Shutdown();
- VerifyOrDie(error == CHIP_NO_ERROR);
+ DeviceLayer::PlatformMgr().Shutdown();
#endif
if (mExchangeMgr != nullptr)
diff --git a/src/controller/CommissioneeDeviceProxy.cpp b/src/controller/CommissioneeDeviceProxy.cpp
index dec9800..af312f7 100644
--- a/src/controller/CommissioneeDeviceProxy.cpp
+++ b/src/controller/CommissioneeDeviceProxy.cpp
@@ -56,9 +56,9 @@
mState = ConnectionState::NotConnected;
}
-CHIP_ERROR CommissioneeDeviceProxy::CloseSession()
+void CommissioneeDeviceProxy::CloseSession()
{
- ReturnErrorCodeIf(mState != ConnectionState::SecureConnected, CHIP_ERROR_INCORRECT_STATE);
+ VerifyOrReturn(mState == ConnectionState::SecureConnected);
if (mSecureSession)
{
mSecureSession->AsSecureSession()->MarkForEviction();
@@ -66,7 +66,6 @@
mState = ConnectionState::NotConnected;
mPairing.Clear();
- return CHIP_NO_ERROR;
}
CHIP_ERROR CommissioneeDeviceProxy::UpdateDeviceData(const Transport::PeerAddress & addr,
diff --git a/src/controller/CommissioneeDeviceProxy.h b/src/controller/CommissioneeDeviceProxy.h
index 972497a..931c76d 100644
--- a/src/controller/CommissioneeDeviceProxy.h
+++ b/src/controller/CommissioneeDeviceProxy.h
@@ -103,9 +103,9 @@
/**
* In case there exists an open session to the device, mark it as expired.
*/
- CHIP_ERROR CloseSession();
+ void CloseSession();
- CHIP_ERROR Disconnect() override { return CloseSession(); }
+ void Disconnect() override { CloseSession(); }
/**
* @brief
@@ -133,6 +133,7 @@
bool IsSessionSetupInProgress() const { return mState == ConnectionState::Connecting; }
NodeId GetDeviceId() const override { return mPeerId.GetNodeId(); }
+ void ShutdownSubscriptions() override {}
PeerId GetPeerId() const { return mPeerId; }
CHIP_ERROR SetPeerId(ByteSpan rcac, ByteSpan noc) override;
const Transport::PeerAddress & GetPeerAddress() const { return mDeviceAddress; }
diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp
index 5bf7a2c..8f8dc16 100644
--- a/src/controller/java/CHIPDeviceController-JNI.cpp
+++ b/src/controller/java/CHIPDeviceController-JNI.cpp
@@ -769,11 +769,8 @@
(JNIEnv * env, jobject self, jlong handle)
{
chip::DeviceLayer::StackLock lock;
- CHIP_ERROR err = CHIP_NO_ERROR;
-
AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle);
- err = wrapper->Controller()->Shutdown();
- VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Controller, "Error invoking shutdownCommissioning: %s", ErrorStr(err)));
+ wrapper->Controller()->Shutdown();
}
JNI_METHOD(jbyteArray, getAttestationChallenge)
diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp
index 9f20992..3c56dc7 100644
--- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp
+++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp
@@ -644,7 +644,8 @@
ChipError::StorageType pychip_DeviceCommissioner_CloseBleConnection(chip::Controller::DeviceCommissioner * devCtrl)
{
#if CONFIG_NETWORK_LAYER_BLE
- return devCtrl->CloseBleConnection().AsInteger();
+ devCtrl->CloseBleConnection();
+ return CHIP_NO_ERROR.AsInteger();
#else
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE.AsInteger();
#endif
diff --git a/src/include/platform/NetworkCommissioning.h b/src/include/platform/NetworkCommissioning.h
index b0cd68c..589f1d1 100644
--- a/src/include/platform/NetworkCommissioning.h
+++ b/src/include/platform/NetworkCommissioning.h
@@ -154,7 +154,7 @@
/**
* @brief Shuts down the driver, this function will be called when shutting down the network commissioning cluster.
*/
- virtual CHIP_ERROR Shutdown() { return CHIP_NO_ERROR; }
+ virtual void Shutdown() {}
/**
* @brief Returns maximum number of network configs can be added to the driver.
diff --git a/src/include/platform/PlatformManager.h b/src/include/platform/PlatformManager.h
index 0d09b67..40d74c4 100644
--- a/src/include/platform/PlatformManager.h
+++ b/src/include/platform/PlatformManager.h
@@ -186,7 +186,7 @@
void LockChipStack();
bool TryLockChipStack();
void UnlockChipStack();
- CHIP_ERROR Shutdown();
+ void Shutdown();
#if CHIP_STACK_LOCK_TRACKING_ENABLED
bool IsChipStackLockedByCurrentThread() const;
@@ -399,12 +399,10 @@
* This DOES NOT stop the chip thread or event queue from running.
*
*/
-inline CHIP_ERROR PlatformManager::Shutdown()
+inline void PlatformManager::Shutdown()
{
- CHIP_ERROR err = static_cast<ImplClass *>(this)->_Shutdown();
- if (err == CHIP_NO_ERROR)
- mInitialized = false;
- return err;
+ static_cast<ImplClass *>(this)->_Shutdown();
+ mInitialized = false;
}
inline void PlatformManager::LockChipStack()
diff --git a/src/include/platform/internal/BLEManager.h b/src/include/platform/internal/BLEManager.h
index 2bb3cd6..6525a50 100644
--- a/src/include/platform/internal/BLEManager.h
+++ b/src/include/platform/internal/BLEManager.h
@@ -54,7 +54,7 @@
using BLEAdvertisingMode = ConnectivityManager::BLEAdvertisingMode;
CHIP_ERROR Init();
- CHIP_ERROR Shutdown();
+ void Shutdown();
CHIPoBLEServiceMode GetCHIPoBLEServiceMode();
CHIP_ERROR SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool IsAdvertisingEnabled();
@@ -117,12 +117,12 @@
return static_cast<ImplClass *>(this)->_Init();
}
-inline CHIP_ERROR BLEManager::Shutdown()
+inline void BLEManager::Shutdown()
{
#if CONFIG_NETWORK_LAYER_BLE
- ReturnErrorOnFailure(GetBleLayer()->Shutdown());
+ GetBleLayer()->Shutdown();
#endif
- return static_cast<ImplClass *>(this)->_Shutdown();
+ static_cast<ImplClass *>(this)->_Shutdown();
}
inline BLEManager::CHIPoBLEServiceMode BLEManager::GetCHIPoBLEServiceMode()
diff --git a/src/include/platform/internal/GenericPlatformManagerImpl.h b/src/include/platform/internal/GenericPlatformManagerImpl.h
index b217a6c..7315174 100644
--- a/src/include/platform/internal/GenericPlatformManagerImpl.h
+++ b/src/include/platform/internal/GenericPlatformManagerImpl.h
@@ -52,7 +52,7 @@
// ===== Methods that implement the PlatformManager abstract interface.
CHIP_ERROR _InitChipStack();
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
CHIP_ERROR _AddEventHandler(PlatformManager::EventHandlerFunct handler, intptr_t arg);
void _RemoveEventHandler(PlatformManager::EventHandlerFunct handler, intptr_t arg);
void _HandleServerStarted();
diff --git a/src/include/platform/internal/GenericPlatformManagerImpl.ipp b/src/include/platform/internal/GenericPlatformManagerImpl.ipp
index 7b05b67..180d949 100644
--- a/src/include/platform/internal/GenericPlatformManagerImpl.ipp
+++ b/src/include/platform/internal/GenericPlatformManagerImpl.ipp
@@ -127,20 +127,18 @@
}
template <class ImplClass>
-CHIP_ERROR GenericPlatformManagerImpl<ImplClass>::_Shutdown()
+void GenericPlatformManagerImpl<ImplClass>::_Shutdown()
{
ChipLogError(DeviceLayer, "Inet Layer shutdown");
- CHIP_ERROR err = UDPEndPointManager()->Shutdown();
+ UDPEndPointManager()->Shutdown();
#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
ChipLogError(DeviceLayer, "BLE shutdown");
- err = BLEMgr().Shutdown();
+ BLEMgr().Shutdown();
#endif
ChipLogError(DeviceLayer, "System Layer shutdown");
- err = SystemLayer().Shutdown();
-
- return err;
+ SystemLayer().Shutdown();
}
template <class ImplClass>
diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.h b/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.h
index 3ad68b4..617e5ca 100644
--- a/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.h
+++ b/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.h
@@ -76,7 +76,7 @@
CHIP_ERROR _StartEventLoopTask(void);
CHIP_ERROR _StopEventLoopTask();
CHIP_ERROR _StartChipTimer(System::Clock::Timeout duration);
- CHIP_ERROR _Shutdown(void);
+ void _Shutdown(void);
#if CHIP_STACK_LOCK_TRACKING_ENABLED
bool _IsChipStackLockedByCurrentThread() const;
diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp b/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp
index da0dbd3..6bbff04 100644
--- a/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp
+++ b/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp
@@ -273,9 +273,8 @@
}
template <class ImplClass>
-CHIP_ERROR GenericPlatformManagerImpl_FreeRTOS<ImplClass>::_Shutdown(void)
+void GenericPlatformManagerImpl_FreeRTOS<ImplClass>::_Shutdown(void)
{
- return CHIP_ERROR_NOT_IMPLEMENTED;
}
template <class ImplClass>
diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.h b/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.h
index a791c67..bf04f54 100644
--- a/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.h
+++ b/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.h
@@ -94,7 +94,7 @@
CHIP_ERROR _StartEventLoopTask();
CHIP_ERROR _StopEventLoopTask();
CHIP_ERROR _StartChipTimer(System::Clock::Timeout duration);
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
#if CHIP_STACK_LOCK_TRACKING_ENABLED
bool _IsChipStackLockedByCurrentThread() const;
diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp b/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp
index 708f44e..15e91dc 100644
--- a/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp
+++ b/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp
@@ -298,7 +298,7 @@
}
template <class ImplClass>
-CHIP_ERROR GenericPlatformManagerImpl_POSIX<ImplClass>::_Shutdown()
+void GenericPlatformManagerImpl_POSIX<ImplClass>::_Shutdown()
{
pthread_mutex_destroy(&mStateLock);
pthread_cond_destroy(&mEventQueueStoppedCond);
@@ -307,7 +307,7 @@
// Call up to the base class _Shutdown() to perform the actual stack de-initialization
// and clean-up
//
- return GenericPlatformManagerImpl<ImplClass>::_Shutdown();
+ GenericPlatformManagerImpl<ImplClass>::_Shutdown();
}
// Fully instantiate the generic implementation class in whatever compilation unit includes this file.
diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.h b/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.h
index 884a052..c4dd017 100644
--- a/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.h
+++ b/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.h
@@ -79,7 +79,7 @@
CHIP_ERROR _StartEventLoopTask(void);
CHIP_ERROR _StopEventLoopTask();
CHIP_ERROR _StartChipTimer(System::Clock::Timeout duration);
- CHIP_ERROR _Shutdown(void);
+ void _Shutdown(void);
// ===== Methods available to the implementation subclass.
explicit GenericPlatformManagerImpl_Zephyr(ThreadStack stack) : mChipThreadStack(stack) {}
@@ -92,6 +92,9 @@
void ProcessDeviceEvents();
volatile bool mShouldRunEventLoop;
+
+ bool mInitialized = false;
+
static void EventLoopTaskMain(void * thisPtr, void *, void *);
};
diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp b/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp
index 217edb7..33a6d1b 100644
--- a/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp
+++ b/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp
@@ -56,6 +56,9 @@
{
CHIP_ERROR err = CHIP_NO_ERROR;
+ if (mInitialized)
+ return err;
+
k_mutex_init(&mChipStackLock);
k_msgq_init(&mChipEventQueue, reinterpret_cast<char *>(&mChipEventRingBuffer), sizeof(ChipDeviceEvent),
@@ -67,6 +70,8 @@
err = GenericPlatformManagerImpl<ImplClass>::_InitChipStack();
SuccessOrExit(err);
+ mInitialized = true;
+
exit:
return err;
}
@@ -104,13 +109,12 @@
}
template <class ImplClass>
-CHIP_ERROR GenericPlatformManagerImpl_Zephyr<ImplClass>::_Shutdown(void)
+void GenericPlatformManagerImpl_Zephyr<ImplClass>::_Shutdown(void)
{
#if CONFIG_REBOOT
sys_reboot(SYS_REBOOT_WARM);
- return CHIP_NO_ERROR;
#else
- return CHIP_ERROR_NOT_IMPLEMENTED;
+ // NB: When this is implemented, |mInitialized| can be removed.
#endif
}
diff --git a/src/inet/InetLayer.h b/src/inet/InetLayer.h
index 8a075e3..771d1df 100644
--- a/src/inet/InetLayer.h
+++ b/src/inet/InetLayer.h
@@ -68,13 +68,11 @@
return CHIP_NO_ERROR;
}
- CHIP_ERROR Shutdown()
+ void Shutdown()
{
// Return to uninitialized state to permit re-initialization.
- VerifyOrReturnError(mLayerState.ResetFromInitialized(), CHIP_ERROR_INCORRECT_STATE);
- VerifyOrReturnError(mSystemLayer->IsInitialized(), CHIP_ERROR_INCORRECT_STATE);
+ mLayerState.ResetFromInitialized();
mSystemLayer = nullptr;
- return CHIP_NO_ERROR;
}
System::Layer & SystemLayer() const { return *mSystemLayer; }
diff --git a/src/inet/TCPEndPoint.cpp b/src/inet/TCPEndPoint.cpp
index de54ece..15b1415 100644
--- a/src/inet/TCPEndPoint.cpp
+++ b/src/inet/TCPEndPoint.cpp
@@ -144,10 +144,9 @@
return 0;
}
-CHIP_ERROR TCPEndPoint::Shutdown()
+void TCPEndPoint::Shutdown()
{
- VerifyOrReturnError(IsConnected(), CHIP_ERROR_INCORRECT_STATE);
- CHIP_ERROR err = CHIP_NO_ERROR;
+ VerifyOrReturn(IsConnected());
// If fully connected, enter the SendShutdown state.
if (mState == State::kConnected)
@@ -159,13 +158,11 @@
// Otherwise, if the peer has already closed their end of the connection,
else if (mState == State::kReceiveShutdown)
{
- err = DoClose(err, false);
+ DoClose(CHIP_NO_ERROR, false);
}
-
- return err;
}
-CHIP_ERROR TCPEndPoint::Close()
+void TCPEndPoint::Close()
{
// Clear the receive queue.
mRcvQueue = nullptr;
@@ -176,7 +173,7 @@
OnConnectComplete = nullptr;
// Perform a graceful close.
- return DoClose(CHIP_NO_ERROR, true);
+ DoClose(CHIP_NO_ERROR, true);
}
void TCPEndPoint::Abort()
@@ -191,8 +188,6 @@
void TCPEndPoint::Free()
{
- CHIP_ERROR err;
-
// Ensure no callbacks to the app after this point.
OnAcceptError = nullptr;
OnConnectComplete = nullptr;
@@ -203,11 +198,7 @@
OnDataSent = nullptr;
// Ensure the end point is Closed or Closing.
- err = Close();
- if (err != CHIP_NO_ERROR)
- {
- Abort();
- }
+ Close();
// Release the Retain() that happened when the end point was allocated.
Release();
@@ -388,7 +379,7 @@
}
}
-CHIP_ERROR TCPEndPoint::DoClose(CHIP_ERROR err, bool suppressCallback)
+void TCPEndPoint::DoClose(CHIP_ERROR err, bool suppressCallback)
{
State oldState = mState;
@@ -415,7 +406,7 @@
// If not making a state transition, return immediately.
if (mState == oldState)
{
- return CHIP_NO_ERROR;
+ return;
}
DoCloseImpl(err, oldState);
@@ -456,8 +447,6 @@
Release();
}
}
-
- return err;
}
#if INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT
diff --git a/src/inet/TCPEndPoint.h b/src/inet/TCPEndPoint.h
index 7c17055..1caddc2 100644
--- a/src/inet/TCPEndPoint.h
+++ b/src/inet/TCPEndPoint.h
@@ -307,24 +307,14 @@
/**
* @brief Initiate TCP half close, in other words, finished with sending.
- *
- * @retval CHIP_NO_ERROR success: address and port extracted.
- * @retval CHIP_ERROR_INCORRECT_STATE TCP connection not established.
- *
- * @retval other another system or platform error
*/
- CHIP_ERROR Shutdown();
+ void Shutdown();
/**
* @brief Initiate TCP full close, in other words, finished with both send and
* receive.
- *
- * @retval CHIP_NO_ERROR success: address and port extracted.
- * @retval CHIP_ERROR_INCORRECT_STATE TCP connection not established.
- *
- * @retval other another system or platform error
*/
- CHIP_ERROR Close();
+ void Close();
/**
* @brief Abortively close the endpoint, in other words, send RST packets.
@@ -609,7 +599,7 @@
void DriveReceiving();
void HandleConnectComplete(CHIP_ERROR err);
void HandleAcceptError(CHIP_ERROR err);
- CHIP_ERROR DoClose(CHIP_ERROR err, bool suppressCallback);
+ void DoClose(CHIP_ERROR err, bool suppressCallback);
static bool IsConnected(State state);
static void TCPConnectTimeoutHandler(chip::System::Layer * aSystemLayer, void * aAppState);
diff --git a/src/inet/tests/TestInetLayer.cpp b/src/inet/tests/TestInetLayer.cpp
index 9704b5b..eb1d174 100644
--- a/src/inet/tests/TestInetLayer.cpp
+++ b/src/inet/tests/TestInetLayer.cpp
@@ -869,8 +869,6 @@
static void CleanupTest()
{
- CHIP_ERROR lStatus;
-
gSendIntervalExpired = false;
gSystemLayer.CancelTimer(Common::HandleSendTimerComplete, nullptr);
@@ -878,9 +876,7 @@
if (sTCPIPEndPoint != nullptr)
{
- lStatus = sTCPIPEndPoint->Close();
- INET_FAIL_ERROR(lStatus, "TCPEndPoint::Close failed");
-
+ sTCPIPEndPoint->Close();
sTCPIPEndPoint->Free();
}
diff --git a/src/lib/dnssd/platform/Dnssd.h b/src/lib/dnssd/platform/Dnssd.h
index c306903..617ba13 100644
--- a/src/lib/dnssd/platform/Dnssd.h
+++ b/src/lib/dnssd/platform/Dnssd.h
@@ -142,12 +142,8 @@
/**
* This function shuts down the mdns module
- *
- * @retval CHIP_NO_ERROR The shutdown succeeds.
- * @retval Error code The shutdown fails
- *
*/
-CHIP_ERROR ChipDnssdShutdown();
+void ChipDnssdShutdown();
/**
* Removes or marks all services being advertised for removal.
diff --git a/src/messaging/ExchangeMgr.cpp b/src/messaging/ExchangeMgr.cpp
index b6ce6a9..410183e 100644
--- a/src/messaging/ExchangeMgr.cpp
+++ b/src/messaging/ExchangeMgr.cpp
@@ -92,9 +92,9 @@
return err;
}
-CHIP_ERROR ExchangeManager::Shutdown()
+void ExchangeManager::Shutdown()
{
- VerifyOrReturnError(mState == State::kState_Initialized, CHIP_ERROR_INCORRECT_STATE);
+ VerifyOrReturn(mState != State::kState_NotInitialized);
mReliableMessageMgr.Shutdown();
@@ -105,8 +105,6 @@
}
mState = State::kState_NotInitialized;
-
- return CHIP_NO_ERROR;
}
ExchangeContext * ExchangeManager::NewContext(const SessionHandle & session, ExchangeDelegate * delegate)
diff --git a/src/messaging/ExchangeMgr.h b/src/messaging/ExchangeMgr.h
index d6b7754..ac796b8 100644
--- a/src/messaging/ExchangeMgr.h
+++ b/src/messaging/ExchangeMgr.h
@@ -81,10 +81,8 @@
* there are no active ExchangeContext objects. Furthermore, it is the
* onus of the application to de-allocate the ExchangeManager
* object after calling ExchangeManager::Shutdown().
- *
- * @return #CHIP_NO_ERROR unconditionally.
*/
- CHIP_ERROR Shutdown();
+ void Shutdown();
/**
* Creates a new ExchangeContext with a given peer CHIP node specified by the peer node identifier.
diff --git a/src/messaging/tests/MessagingContext.cpp b/src/messaging/tests/MessagingContext.cpp
index daaa5a1..127b1a1 100644
--- a/src/messaging/tests/MessagingContext.cpp
+++ b/src/messaging/tests/MessagingContext.cpp
@@ -73,9 +73,9 @@
}
// Shutdown all layers, finalize operations
-CHIP_ERROR MessagingContext::Shutdown()
+void MessagingContext::Shutdown()
{
- VerifyOrReturnError(mInitialized == true, CHIP_ERROR_INTERNAL);
+ VerifyOrDie(mInitialized);
mInitialized = false;
mExchangeManager.Shutdown();
@@ -83,7 +83,6 @@
mFabricTable.Shutdown();
mOpCertStore.Finish();
mOpKeyStore.Finish();
- return CHIP_NO_ERROR;
}
CHIP_ERROR MessagingContext::InitFromExisting(const MessagingContext & existing)
@@ -91,13 +90,12 @@
return Init(existing.mTransport, existing.mIOContext);
}
-CHIP_ERROR MessagingContext::ShutdownAndRestoreExisting(MessagingContext & existing)
+void MessagingContext::ShutdownAndRestoreExisting(MessagingContext & existing)
{
- CHIP_ERROR err = Shutdown();
+ Shutdown();
// Point the transport back to the original session manager, since we had
// pointed it to ours.
existing.mTransport->SetSessionManager(&existing.GetSecureSessionManager());
- return err;
}
CHIP_ERROR MessagingContext::CreateSessionBobToAlice()
diff --git a/src/messaging/tests/MessagingContext.h b/src/messaging/tests/MessagingContext.h
index 19e94b5..8c13fdd 100644
--- a/src/messaging/tests/MessagingContext.h
+++ b/src/messaging/tests/MessagingContext.h
@@ -84,7 +84,7 @@
CHIP_ERROR Init(TransportMgrBase * transport, IOContext * io);
// Shutdown all layers, finalize operations
- CHIP_ERROR Shutdown();
+ void Shutdown();
// Initialize from an existing messaging context. Useful if we want to
// share some state (like the transport).
@@ -92,7 +92,7 @@
// The shutdown method to use if using InitFromExisting. Must pass in the
// same existing context as was passed to InitFromExisting.
- CHIP_ERROR ShutdownAndRestoreExisting(MessagingContext & existing);
+ void ShutdownAndRestoreExisting(MessagingContext & existing);
static Inet::IPAddress GetAddress()
{
@@ -188,12 +188,11 @@
}
// Shutdown all layers, finalize operations
- virtual CHIP_ERROR Shutdown()
+ virtual void Shutdown()
{
- ReturnErrorOnFailure(MessagingContext::Shutdown());
- ReturnErrorOnFailure(LoopbackTransportManager::Shutdown());
+ MessagingContext::Shutdown();
+ LoopbackTransportManager::Shutdown();
chip::Platform::MemoryShutdown();
- return CHIP_NO_ERROR;
}
// Init/Shutdown Helpers that can be used directly as the nlTestSuite
@@ -207,7 +206,8 @@
static int Finalize(void * context)
{
auto * ctx = static_cast<LoopbackMessagingContext *>(context);
- return ctx->Shutdown() == CHIP_NO_ERROR ? SUCCESS : FAILURE;
+ ctx->Shutdown();
+ return SUCCESS;
}
using LoopbackTransportManager::GetSystemLayer;
diff --git a/src/platform/Ameba/BLEManagerImpl.h b/src/platform/Ameba/BLEManagerImpl.h
index 1886a94..07cf5f2 100755
--- a/src/platform/Ameba/BLEManagerImpl.h
+++ b/src/platform/Ameba/BLEManagerImpl.h
@@ -46,7 +46,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/Ameba/NetworkCommissioningDriver.h b/src/platform/Ameba/NetworkCommissioningDriver.h
index 8b86a3d..70708df 100644
--- a/src/platform/Ameba/NetworkCommissioningDriver.h
+++ b/src/platform/Ameba/NetworkCommissioningDriver.h
@@ -90,7 +90,7 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); }
CHIP_ERROR Init(NetworkStatusChangeCallback * networkStatusChangeCallback) override;
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
// WirelessDriver
uint8_t GetMaxNetworks() override { return kMaxWiFiNetworks; }
diff --git a/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp b/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp
index e5754f4..5ad6323 100644
--- a/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp
+++ b/src/platform/Ameba/NetworkCommissioningWiFiDriver.cpp
@@ -56,10 +56,9 @@
return err;
}
-CHIP_ERROR AmebaWiFiDriver::Shutdown()
+void AmebaWiFiDriver::Shutdown()
{
mpStatusChangeCallback = nullptr;
- return CHIP_NO_ERROR;
}
CHIP_ERROR AmebaWiFiDriver::CommitConfiguration()
diff --git a/src/platform/Ameba/PlatformManagerImpl.cpp b/src/platform/Ameba/PlatformManagerImpl.cpp
index 8c6c933..b3231cd 100644
--- a/src/platform/Ameba/PlatformManagerImpl.cpp
+++ b/src/platform/Ameba/PlatformManagerImpl.cpp
@@ -88,7 +88,7 @@
return err;
}
-CHIP_ERROR PlatformManagerImpl::_Shutdown()
+void PlatformManagerImpl::_Shutdown()
{
uint64_t upTime = 0;
@@ -110,7 +110,7 @@
ChipLogError(DeviceLayer, "Failed to get current uptime since the Node’s last reboot");
}
- return Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
+ Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
}
} // namespace DeviceLayer
diff --git a/src/platform/Ameba/PlatformManagerImpl.h b/src/platform/Ameba/PlatformManagerImpl.h
index 25263e0..52f5373 100644
--- a/src/platform/Ameba/PlatformManagerImpl.h
+++ b/src/platform/Ameba/PlatformManagerImpl.h
@@ -53,7 +53,7 @@
// ===== Methods that implement the PlatformManager abstract interface.
CHIP_ERROR _InitChipStack(void);
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
// ===== Members for internal use by the following friends.
diff --git a/src/platform/CYW30739/BLEManagerImpl.h b/src/platform/CYW30739/BLEManagerImpl.h
index 9aedc3a..2b5d8bc 100644
--- a/src/platform/CYW30739/BLEManagerImpl.h
+++ b/src/platform/CYW30739/BLEManagerImpl.h
@@ -51,7 +51,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/CYW30739/PlatformManagerImpl.cpp b/src/platform/CYW30739/PlatformManagerImpl.cpp
index 58ac04d..35c48fc 100644
--- a/src/platform/CYW30739/PlatformManagerImpl.cpp
+++ b/src/platform/CYW30739/PlatformManagerImpl.cpp
@@ -173,10 +173,7 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR PlatformManagerImpl::_Shutdown()
-{
- return CHIP_NO_ERROR;
-}
+void PlatformManagerImpl::_Shutdown() {}
void PlatformManagerImpl::SetEventFlags(uint32_t flags)
{
diff --git a/src/platform/CYW30739/PlatformManagerImpl.h b/src/platform/CYW30739/PlatformManagerImpl.h
index c10f35a..7d121f1 100644
--- a/src/platform/CYW30739/PlatformManagerImpl.h
+++ b/src/platform/CYW30739/PlatformManagerImpl.h
@@ -55,7 +55,7 @@
void _UnlockChipStack(void);
CHIP_ERROR _PostEvent(const ChipDeviceEvent * event);
CHIP_ERROR _StartChipTimer(System::Clock::Timeout durationMS);
- CHIP_ERROR _Shutdown(void);
+ void _Shutdown(void);
void SetEventFlags(uint32_t flags);
void HandleTimerEvent(void);
diff --git a/src/platform/Darwin/BLEManagerImpl.h b/src/platform/Darwin/BLEManagerImpl.h
index a449a64..0554b22 100644
--- a/src/platform/Darwin/BLEManagerImpl.h
+++ b/src/platform/Darwin/BLEManagerImpl.h
@@ -47,7 +47,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/Darwin/DnssdImpl.cpp b/src/platform/Darwin/DnssdImpl.cpp
index 1358d1d..488998c 100644
--- a/src/platform/Darwin/DnssdImpl.cpp
+++ b/src/platform/Darwin/DnssdImpl.cpp
@@ -355,10 +355,7 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR ChipDnssdShutdown()
-{
- return CHIP_NO_ERROR;
-}
+void ChipDnssdShutdown() {}
CHIP_ERROR ChipDnssdPublishService(const DnssdService * service, DnssdPublishCallback callback, void * context)
{
diff --git a/src/platform/Darwin/PlatformManagerImpl.cpp b/src/platform/Darwin/PlatformManagerImpl.cpp
index cc226c9..3c85bee 100644
--- a/src/platform/Darwin/PlatformManagerImpl.cpp
+++ b/src/platform/Darwin/PlatformManagerImpl.cpp
@@ -118,10 +118,10 @@
dispatch_semaphore_wait(mRunLoopSem, DISPATCH_TIME_FOREVER);
}
-CHIP_ERROR PlatformManagerImpl::_Shutdown()
+void PlatformManagerImpl::_Shutdown()
{
// Call up to the base class _Shutdown() to perform the bulk of the shutdown.
- return GenericPlatformManagerImpl<ImplClass>::_Shutdown();
+ GenericPlatformManagerImpl<ImplClass>::_Shutdown();
}
CHIP_ERROR PlatformManagerImpl::_PostEvent(const ChipDeviceEvent * event)
diff --git a/src/platform/Darwin/PlatformManagerImpl.h b/src/platform/Darwin/PlatformManagerImpl.h
index 74582e0..72b0bd9 100644
--- a/src/platform/Darwin/PlatformManagerImpl.h
+++ b/src/platform/Darwin/PlatformManagerImpl.h
@@ -58,7 +58,7 @@
private:
// ===== Methods that implement the PlatformManager abstract interface.
CHIP_ERROR _InitChipStack();
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
CHIP_ERROR _StartChipTimer(System::Clock::Timeout delay) { return CHIP_ERROR_NOT_IMPLEMENTED; };
CHIP_ERROR _StartEventLoopTask();
diff --git a/src/platform/EFR32/BLEManagerImpl.h b/src/platform/EFR32/BLEManagerImpl.h
index 131a833..19e3900 100644
--- a/src/platform/EFR32/BLEManagerImpl.h
+++ b/src/platform/EFR32/BLEManagerImpl.h
@@ -49,7 +49,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/EFR32/PlatformManagerImpl.cpp b/src/platform/EFR32/PlatformManagerImpl.cpp
index 3db6ab7..ab3c20d 100644
--- a/src/platform/EFR32/PlatformManagerImpl.cpp
+++ b/src/platform/EFR32/PlatformManagerImpl.cpp
@@ -69,7 +69,7 @@
return err;
}
-CHIP_ERROR PlatformManagerImpl::_Shutdown()
+void PlatformManagerImpl::_Shutdown()
{
uint64_t upTime = 0;
@@ -91,7 +91,7 @@
ChipLogError(DeviceLayer, "Failed to get current uptime since the Node’s last reboot");
}
- return Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
+ Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
}
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION
void PlatformManagerImpl::HandleWFXSystemEvent(wfx_event_base_t eventBase, sl_wfx_generic_message_t * eventData)
diff --git a/src/platform/EFR32/PlatformManagerImpl.h b/src/platform/EFR32/PlatformManagerImpl.h
index 975fd6a..39e2be6 100644
--- a/src/platform/EFR32/PlatformManagerImpl.h
+++ b/src/platform/EFR32/PlatformManagerImpl.h
@@ -59,7 +59,7 @@
// ===== Methods that implement the PlatformManager abstract interface.
CHIP_ERROR _InitChipStack(void);
- CHIP_ERROR _Shutdown(void);
+ void _Shutdown(void);
// ===== Members for internal use by the following friends.
diff --git a/src/platform/ESP32/BLEManagerImpl.h b/src/platform/ESP32/BLEManagerImpl.h
index b62fde0..cc47517 100644
--- a/src/platform/ESP32/BLEManagerImpl.h
+++ b/src/platform/ESP32/BLEManagerImpl.h
@@ -81,7 +81,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/ESP32/DnssdImpl.cpp b/src/platform/ESP32/DnssdImpl.cpp
index 0b3833a..cef2b07 100644
--- a/src/platform/ESP32/DnssdImpl.cpp
+++ b/src/platform/ESP32/DnssdImpl.cpp
@@ -131,10 +131,7 @@
return error;
}
-CHIP_ERROR ChipDnssdShutdown()
-{
- return CHIP_NO_ERROR;
-}
+void ChipDnssdShutdown() {}
static const char * GetProtocolString(DnssdServiceProtocol protocol)
{
diff --git a/src/platform/ESP32/NetworkCommissioningDriver.cpp b/src/platform/ESP32/NetworkCommissioningDriver.cpp
index ced3d34..58bc3b2 100644
--- a/src/platform/ESP32/NetworkCommissioningDriver.cpp
+++ b/src/platform/ESP32/NetworkCommissioningDriver.cpp
@@ -66,10 +66,9 @@
return err;
}
-CHIP_ERROR ESPWiFiDriver::Shutdown()
+void ESPWiFiDriver::Shutdown()
{
mpStatusChangeCallback = nullptr;
- return CHIP_NO_ERROR;
}
CHIP_ERROR ESPWiFiDriver::CommitConfiguration()
diff --git a/src/platform/ESP32/NetworkCommissioningDriver.h b/src/platform/ESP32/NetworkCommissioningDriver.h
index fd3f1dd..d8d9288 100644
--- a/src/platform/ESP32/NetworkCommissioningDriver.h
+++ b/src/platform/ESP32/NetworkCommissioningDriver.h
@@ -88,7 +88,7 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); }
CHIP_ERROR Init(NetworkStatusChangeCallback * networkStatusChangeCallback) override;
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
// WirelessDriver
uint8_t GetMaxNetworks() override { return kMaxWiFiNetworks; }
diff --git a/src/platform/ESP32/PlatformManagerImpl.cpp b/src/platform/ESP32/PlatformManagerImpl.cpp
index 6c15b7c..51413c6 100644
--- a/src/platform/ESP32/PlatformManagerImpl.cpp
+++ b/src/platform/ESP32/PlatformManagerImpl.cpp
@@ -131,7 +131,7 @@
return chip::DeviceLayer::Internal::ESP32Utils::MapError(err);
}
-CHIP_ERROR PlatformManagerImpl::_Shutdown()
+void PlatformManagerImpl::_Shutdown()
{
uint64_t upTime = 0;
@@ -153,7 +153,7 @@
ChipLogError(DeviceLayer, "Failed to get current uptime since the Node’s last reboot");
}
- return Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
+ Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
}
void PlatformManagerImpl::HandleESPSystemEvent(void * arg, esp_event_base_t eventBase, int32_t eventId, void * eventData)
diff --git a/src/platform/ESP32/PlatformManagerImpl.h b/src/platform/ESP32/PlatformManagerImpl.h
index f5672f9..cc2b0ee 100644
--- a/src/platform/ESP32/PlatformManagerImpl.h
+++ b/src/platform/ESP32/PlatformManagerImpl.h
@@ -57,7 +57,7 @@
// ===== Methods that implement the PlatformManager abstract interface.
CHIP_ERROR _InitChipStack(void);
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
// ===== Members for internal use by the following friends.
diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp
index 133cf0b..13e5558 100644
--- a/src/platform/Linux/BLEManagerImpl.cpp
+++ b/src/platform/Linux/BLEManagerImpl.cpp
@@ -93,12 +93,10 @@
return err;
}
-CHIP_ERROR BLEManagerImpl::_Shutdown()
+void BLEManagerImpl::_Shutdown()
{
// ensure scan resources are cleared (e.g. timeout timers)
mDeviceScanner.reset();
-
- return CHIP_NO_ERROR;
}
CHIP_ERROR BLEManagerImpl::_SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val)
diff --git a/src/platform/Linux/BLEManagerImpl.h b/src/platform/Linux/BLEManagerImpl.h
index 87a8f83..6d898dc 100644
--- a/src/platform/Linux/BLEManagerImpl.h
+++ b/src/platform/Linux/BLEManagerImpl.h
@@ -112,7 +112,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init();
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode();
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled();
diff --git a/src/platform/Linux/DnssdImpl.cpp b/src/platform/Linux/DnssdImpl.cpp
index 9b345b6..59f5012 100644
--- a/src/platform/Linux/DnssdImpl.cpp
+++ b/src/platform/Linux/DnssdImpl.cpp
@@ -328,10 +328,7 @@
CHIP_ERROR error = CHIP_NO_ERROR;
int avahiError = 0;
- if (Shutdown() != CHIP_NO_ERROR)
- {
- ChipLogError(DeviceLayer, "Shutdown() failed, continue anyway...");
- }
+ Shutdown();
VerifyOrExit(initCallback != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrExit(errorCallback != nullptr, error = CHIP_ERROR_INVALID_ARGUMENT);
@@ -347,7 +344,7 @@
return error;
}
-CHIP_ERROR MdnsAvahi::Shutdown()
+void MdnsAvahi::Shutdown()
{
if (mGroup)
{
@@ -359,7 +356,6 @@
avahi_client_free(mClient);
mClient = nullptr;
}
- return CHIP_NO_ERROR;
}
CHIP_ERROR MdnsAvahi::SetHostname(const char * hostname)
@@ -826,9 +822,9 @@
return MdnsAvahi::GetInstance().Init(initCallback, errorCallback, context);
}
-CHIP_ERROR ChipDnssdShutdown()
+void ChipDnssdShutdown()
{
- return MdnsAvahi::GetInstance().Shutdown();
+ MdnsAvahi::GetInstance().Shutdown();
}
CHIP_ERROR ChipDnssdPublishService(const DnssdService * service, DnssdPublishCallback callback, void * context)
diff --git a/src/platform/Linux/DnssdImpl.h b/src/platform/Linux/DnssdImpl.h
index ffc6d47..e711180 100644
--- a/src/platform/Linux/DnssdImpl.h
+++ b/src/platform/Linux/DnssdImpl.h
@@ -105,7 +105,7 @@
MdnsAvahi & operator=(const MdnsAvahi &) = delete;
CHIP_ERROR Init(DnssdAsyncReturnCallback initCallback, DnssdAsyncReturnCallback errorCallback, void * context);
- CHIP_ERROR Shutdown();
+ void Shutdown();
CHIP_ERROR SetHostname(const char * hostname);
CHIP_ERROR PublishService(const DnssdService & service, DnssdPublishCallback callback, void * context);
CHIP_ERROR StopPublish();
diff --git a/src/platform/Linux/NetworkCommissioningDriver.h b/src/platform/Linux/NetworkCommissioningDriver.h
index f0bce19..e0e522a 100644
--- a/src/platform/Linux/NetworkCommissioningDriver.h
+++ b/src/platform/Linux/NetworkCommissioningDriver.h
@@ -80,7 +80,7 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); }
CHIP_ERROR Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) override;
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
// WirelessDriver
uint8_t GetMaxNetworks() override { return 1; }
@@ -130,7 +130,7 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new ThreadNetworkIterator(this); }
CHIP_ERROR Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) override;
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
// WirelessDriver
uint8_t GetMaxNetworks() override { return 1; }
diff --git a/src/platform/Linux/NetworkCommissioningThreadDriver.cpp b/src/platform/Linux/NetworkCommissioningThreadDriver.cpp
index 8f92702..ed82e2a 100644
--- a/src/platform/Linux/NetworkCommissioningThreadDriver.cpp
+++ b/src/platform/Linux/NetworkCommissioningThreadDriver.cpp
@@ -53,10 +53,9 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR LinuxThreadDriver::Shutdown()
+void LinuxThreadDriver::Shutdown()
{
ThreadStackMgrImpl().SetNetworkStatusChangeCallback(nullptr);
- return CHIP_NO_ERROR;
}
CHIP_ERROR LinuxThreadDriver::CommitConfiguration()
diff --git a/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp b/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp
index ff9b95a..68ffb9d 100644
--- a/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp
+++ b/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp
@@ -78,10 +78,9 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR LinuxWiFiDriver::Shutdown()
+void LinuxWiFiDriver::Shutdown()
{
ConnectivityMgrImpl().SetNetworkStatusChangeCallback(nullptr);
- return CHIP_NO_ERROR;
}
CHIP_ERROR LinuxWiFiDriver::CommitConfiguration()
diff --git a/src/platform/Linux/PlatformManagerImpl.cpp b/src/platform/Linux/PlatformManagerImpl.cpp
index 791512c..852e060 100644
--- a/src/platform/Linux/PlatformManagerImpl.cpp
+++ b/src/platform/Linux/PlatformManagerImpl.cpp
@@ -186,7 +186,7 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR PlatformManagerImpl::_Shutdown()
+void PlatformManagerImpl::_Shutdown()
{
uint64_t upTime = 0;
@@ -208,7 +208,7 @@
ChipLogError(DeviceLayer, "Failed to get current uptime since the Node’s last reboot");
}
- return Internal::GenericPlatformManagerImpl_POSIX<PlatformManagerImpl>::_Shutdown();
+ Internal::GenericPlatformManagerImpl_POSIX<PlatformManagerImpl>::_Shutdown();
}
#if CHIP_WITH_GIO
diff --git a/src/platform/Linux/PlatformManagerImpl.h b/src/platform/Linux/PlatformManagerImpl.h
index 591121d..fb1f25c 100644
--- a/src/platform/Linux/PlatformManagerImpl.h
+++ b/src/platform/Linux/PlatformManagerImpl.h
@@ -60,7 +60,7 @@
// ===== Methods that implement the PlatformManager abstract interface.
CHIP_ERROR _InitChipStack();
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
// ===== Members for internal use by the following friends.
diff --git a/src/platform/OpenThread/DnssdImpl.cpp b/src/platform/OpenThread/DnssdImpl.cpp
index 0faed87..0a0f3e4 100644
--- a/src/platform/OpenThread/DnssdImpl.cpp
+++ b/src/platform/OpenThread/DnssdImpl.cpp
@@ -39,10 +39,7 @@
return ThreadStackMgr().ClearSrpHost(hostname);
}
-CHIP_ERROR ChipDnssdShutdown()
-{
- return CHIP_NO_ERROR;
-}
+void ChipDnssdShutdown() {}
const char * GetProtocolString(DnssdServiceProtocol protocol)
{
diff --git a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp
index 330bc56..b48c091 100644
--- a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp
+++ b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp
@@ -57,10 +57,9 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR GenericThreadDriver::Shutdown()
+void GenericThreadDriver::Shutdown()
{
ThreadStackMgrImpl().SetNetworkStatusChangeCallback(nullptr);
- return CHIP_NO_ERROR;
}
CHIP_ERROR GenericThreadDriver::CommitConfiguration()
diff --git a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h
index 60a1db9..05050b9 100644
--- a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h
+++ b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h
@@ -85,7 +85,7 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new ThreadNetworkIterator(this); }
CHIP_ERROR Init(Internal::BaseDriver::NetworkStatusChangeCallback * statusChangeCallback) override;
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
// WirelessDriver
uint8_t GetMaxNetworks() override { return 1; }
diff --git a/src/platform/P6/BLEManagerImpl.h b/src/platform/P6/BLEManagerImpl.h
index 545dc44..5f47096 100644
--- a/src/platform/P6/BLEManagerImpl.h
+++ b/src/platform/P6/BLEManagerImpl.h
@@ -51,7 +51,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/P6/NetworkCommissioningDriver.h b/src/platform/P6/NetworkCommissioningDriver.h
index 081f8df..e56967f 100644
--- a/src/platform/P6/NetworkCommissioningDriver.h
+++ b/src/platform/P6/NetworkCommissioningDriver.h
@@ -92,7 +92,7 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); }
CHIP_ERROR Init(NetworkStatusChangeCallback * networkStatusChangeCallback) override;
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
// WirelessDriver
uint8_t GetMaxNetworks() override { return kMaxWiFiNetworks; }
diff --git a/src/platform/P6/NetworkCommissioningWiFiDriver.cpp b/src/platform/P6/NetworkCommissioningWiFiDriver.cpp
index e9ca4f9..56c98f5 100644
--- a/src/platform/P6/NetworkCommissioningWiFiDriver.cpp
+++ b/src/platform/P6/NetworkCommissioningWiFiDriver.cpp
@@ -69,10 +69,9 @@
return err;
}
-CHIP_ERROR P6WiFiDriver::Shutdown()
+void P6WiFiDriver::Shutdown()
{
mpStatusChangeCallback = nullptr;
- return CHIP_NO_ERROR;
}
CHIP_ERROR P6WiFiDriver::CommitConfiguration()
diff --git a/src/platform/P6/PlatformManagerImpl.cpp b/src/platform/P6/PlatformManagerImpl.cpp
index 95bc6bd..90b99a6 100644
--- a/src/platform/P6/PlatformManagerImpl.cpp
+++ b/src/platform/P6/PlatformManagerImpl.cpp
@@ -66,7 +66,7 @@
return Internal::InitLwIPCoreLock();
}
-CHIP_ERROR PlatformManagerImpl::_Shutdown()
+void PlatformManagerImpl::_Shutdown()
{
uint64_t upTime = 0;
@@ -88,7 +88,7 @@
ChipLogError(DeviceLayer, "Failed to get current uptime since the Node’s last reboot");
}
- return Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
+ Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
}
} // namespace DeviceLayer
diff --git a/src/platform/P6/PlatformManagerImpl.h b/src/platform/P6/PlatformManagerImpl.h
index f7c56ac..1fd0193 100644
--- a/src/platform/P6/PlatformManagerImpl.h
+++ b/src/platform/P6/PlatformManagerImpl.h
@@ -55,7 +55,7 @@
// ===== Methods that implement the PlatformManager abstract interface.
CHIP_ERROR _InitChipStack(void);
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
// ===== Members for internal use by the following friends.
diff --git a/src/platform/Tizen/BLEManagerImpl.h b/src/platform/Tizen/BLEManagerImpl.h
index 51ed295..36dfa46 100644
--- a/src/platform/Tizen/BLEManagerImpl.h
+++ b/src/platform/Tizen/BLEManagerImpl.h
@@ -87,7 +87,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/Tizen/DnssdImpl.cpp b/src/platform/Tizen/DnssdImpl.cpp
index 1b57f66..03f13c3 100644
--- a/src/platform/Tizen/DnssdImpl.cpp
+++ b/src/platform/Tizen/DnssdImpl.cpp
@@ -460,11 +460,11 @@
return CHIP_ERROR_INTERNAL;
}
-CHIP_ERROR DnssdTizen::Shutdown()
+void DnssdTizen::Shutdown()
{
int ret = dnssd_deinitialize();
- VerifyOrReturnError(ret == DNSSD_ERROR_NONE, CHIP_ERROR_INTERNAL);
- return CHIP_NO_ERROR;
+ if (ret != DNSSD_ERROR_NONE)
+ ChipLogError(DeviceLayer, "DNSsd %s: Error: %d", __func__, ret);
}
CHIP_ERROR DnssdTizen::RegisterService(const DnssdService & service, DnssdPublishCallback callback, void * context)
@@ -685,9 +685,9 @@
return DnssdTizen::GetInstance().Init(initCallback, errorCallback, context);
}
-CHIP_ERROR ChipDnssdShutdown()
+void ChipDnssdShutdown()
{
- return DnssdTizen::GetInstance().Shutdown();
+ DnssdTizen::GetInstance().Shutdown();
}
CHIP_ERROR ChipDnssdPublishService(const DnssdService * service, DnssdPublishCallback callback, void * context)
diff --git a/src/platform/Tizen/DnssdImpl.h b/src/platform/Tizen/DnssdImpl.h
index fa34dcf..28bcf31 100755
--- a/src/platform/Tizen/DnssdImpl.h
+++ b/src/platform/Tizen/DnssdImpl.h
@@ -112,7 +112,7 @@
DnssdTizen & operator=(const DnssdTizen &) = delete;
CHIP_ERROR Init(DnssdAsyncReturnCallback initCallback, DnssdAsyncReturnCallback errorCallback, void * context);
- CHIP_ERROR Shutdown();
+ void Shutdown();
CHIP_ERROR RegisterService(const DnssdService & service, DnssdPublishCallback callback, void * context);
CHIP_ERROR UnregisterAllServices();
diff --git a/src/platform/Tizen/NetworkCommissioningDriver.h b/src/platform/Tizen/NetworkCommissioningDriver.h
index 7cd71bf..d128b8a 100644
--- a/src/platform/Tizen/NetworkCommissioningDriver.h
+++ b/src/platform/Tizen/NetworkCommissioningDriver.h
@@ -53,7 +53,6 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); }
CHIP_ERROR Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) override;
- CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; }
// WirelessDriver
uint8_t GetMaxNetworks() override { return 1; }
@@ -102,7 +101,6 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new ThreadNetworkIterator(this); }
CHIP_ERROR Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) override;
- CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; }
// WirelessDriver
uint8_t GetMaxNetworks() override { return 1; }
diff --git a/src/platform/Zephyr/BLEManagerImpl.h b/src/platform/Zephyr/BLEManagerImpl.h
index 238d563..e72adbf 100644
--- a/src/platform/Zephyr/BLEManagerImpl.h
+++ b/src/platform/Zephyr/BLEManagerImpl.h
@@ -59,7 +59,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/android/BLEManagerImpl.h b/src/platform/android/BLEManagerImpl.h
index 1b2b062..af014c1 100644
--- a/src/platform/android/BLEManagerImpl.h
+++ b/src/platform/android/BLEManagerImpl.h
@@ -56,7 +56,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init();
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode();
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled();
diff --git a/src/platform/android/DnssdImpl.cpp b/src/platform/android/DnssdImpl.cpp
index d536fdd..f3da56a 100644
--- a/src/platform/android/DnssdImpl.cpp
+++ b/src/platform/android/DnssdImpl.cpp
@@ -61,10 +61,7 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR ChipDnssdShutdown()
-{
- return CHIP_NO_ERROR;
-}
+void ChipDnssdShutdown() {}
CHIP_ERROR ChipDnssdRemoveServices()
{
diff --git a/src/platform/bouffalolab/BL602/BLEManagerImpl.h b/src/platform/bouffalolab/BL602/BLEManagerImpl.h
index e4c8e64..0e7fc52 100644
--- a/src/platform/bouffalolab/BL602/BLEManagerImpl.h
+++ b/src/platform/bouffalolab/BL602/BLEManagerImpl.h
@@ -50,7 +50,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/bouffalolab/BL602/DnssdImpl.cpp b/src/platform/bouffalolab/BL602/DnssdImpl.cpp
index 2caacae..15e2c98 100644
--- a/src/platform/bouffalolab/BL602/DnssdImpl.cpp
+++ b/src/platform/bouffalolab/BL602/DnssdImpl.cpp
@@ -77,10 +77,7 @@
return error;
}
-CHIP_ERROR ChipDnssdShutdown()
-{
- return CHIP_NO_ERROR;
-}
+void ChipDnssdShutdown() {}
static const char * GetProtocolString(DnssdServiceProtocol protocol)
{
diff --git a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp
index 0fa7a05..3e58803 100644
--- a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp
+++ b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp
@@ -76,10 +76,9 @@
return err;
}
-CHIP_ERROR BLWiFiDriver::Shutdown()
+void BLWiFiDriver::Shutdown()
{
mpStatusChangeCallback = nullptr;
- return CHIP_NO_ERROR;
}
CHIP_ERROR BLWiFiDriver::CommitConfiguration()
diff --git a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h
index 31b7f4c..c5bfac6 100644
--- a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h
+++ b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h
@@ -90,7 +90,7 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); }
CHIP_ERROR Init(NetworkStatusChangeCallback * networkStatusChangeCallback) override;
- CHIP_ERROR Shutdown();
+ void Shutdown();
// WirelessDriver
uint8_t GetMaxNetworks() override { return kMaxWiFiNetworks; }
diff --git a/src/platform/bouffalolab/BL602/NetworkCommissioningWiFiDriver.cpp b/src/platform/bouffalolab/BL602/NetworkCommissioningWiFiDriver.cpp
index 23b0ff8..c9a35fe 100644
--- a/src/platform/bouffalolab/BL602/NetworkCommissioningWiFiDriver.cpp
+++ b/src/platform/bouffalolab/BL602/NetworkCommissioningWiFiDriver.cpp
@@ -71,10 +71,7 @@
return err;
}
-CHIP_ERROR BLWiFiDriver::Shutdown()
-{
- return CHIP_NO_ERROR;
-}
+void BLWiFiDriver::Shutdown() {}
CHIP_ERROR BLWiFiDriver::CommitConfiguration()
{
diff --git a/src/platform/cc13x2_26x2/BLEManagerImpl.h b/src/platform/cc13x2_26x2/BLEManagerImpl.h
index 76c055c..42f2181 100644
--- a/src/platform/cc13x2_26x2/BLEManagerImpl.h
+++ b/src/platform/cc13x2_26x2/BLEManagerImpl.h
@@ -207,7 +207,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/fake/DnssdImpl.cpp b/src/platform/fake/DnssdImpl.cpp
index 2dd189d..8886d99 100644
--- a/src/platform/fake/DnssdImpl.cpp
+++ b/src/platform/fake/DnssdImpl.cpp
@@ -96,10 +96,7 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR ChipDnssdShutdown()
-{
- return CHIP_NO_ERROR;
-}
+void ChipDnssdShutdown() {}
CHIP_ERROR ChipDnssdPublishService(const DnssdService * service, DnssdPublishCallback callback, void * context)
{
diff --git a/src/platform/fake/PlatformManagerImpl.h b/src/platform/fake/PlatformManagerImpl.h
index d4181bf..47904d4 100644
--- a/src/platform/fake/PlatformManagerImpl.h
+++ b/src/platform/fake/PlatformManagerImpl.h
@@ -45,7 +45,7 @@
// ===== Methods that implement the PlatformManager abstract interface.
CHIP_ERROR _InitChipStack() { return CHIP_NO_ERROR; }
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIP_ERROR _AddEventHandler(EventHandlerFunct handler, intptr_t arg = 0) { return CHIP_ERROR_NOT_IMPLEMENTED; }
void _RemoveEventHandler(EventHandlerFunct handler, intptr_t arg = 0) {}
diff --git a/src/platform/mbed/BLEManagerImpl.h b/src/platform/mbed/BLEManagerImpl.h
index fc96bc4..31db5f9 100644
--- a/src/platform/mbed/BLEManagerImpl.h
+++ b/src/platform/mbed/BLEManagerImpl.h
@@ -46,7 +46,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/mbed/NetworkCommissioningDriver.h b/src/platform/mbed/NetworkCommissioningDriver.h
index 26e3fe7..29c917c 100644
--- a/src/platform/mbed/NetworkCommissioningDriver.h
+++ b/src/platform/mbed/NetworkCommissioningDriver.h
@@ -94,7 +94,7 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); }
CHIP_ERROR Init(NetworkStatusChangeCallback * networkStatusChangeCallback) override;
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
// WirelessDriver
uint8_t GetMaxNetworks() override { return kMaxWiFiNetworks; }
diff --git a/src/platform/mbed/NetworkCommissioningWiFiDriver.cpp b/src/platform/mbed/NetworkCommissioningWiFiDriver.cpp
index 81e55a8..ee9f187 100644
--- a/src/platform/mbed/NetworkCommissioningWiFiDriver.cpp
+++ b/src/platform/mbed/NetworkCommissioningWiFiDriver.cpp
@@ -87,7 +87,7 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR WiFiDriverImpl::Shutdown()
+void WiFiDriverImpl::Shutdown()
{
Network network;
auto networks = GetNetworks();
@@ -115,8 +115,6 @@
mStagingNetwork.credentialsLen = 0;
mSavedNetwork.ssidLen = 0;
mSavedNetwork.credentialsLen = 0;
-
- return CHIP_NO_ERROR;
}
CHIP_ERROR WiFiDriverImpl::CommitConfiguration()
diff --git a/src/platform/mbed/PlatformManagerImpl.cpp b/src/platform/mbed/PlatformManagerImpl.cpp
index eb34cf2..089f1d8 100644
--- a/src/platform/mbed/PlatformManagerImpl.cpp
+++ b/src/platform/mbed/PlatformManagerImpl.cpp
@@ -270,19 +270,15 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR PlatformManagerImpl::_Shutdown()
+void PlatformManagerImpl::_Shutdown()
{
//
// Call up to the base class _Shutdown() to perform the actual stack de-initialization
// and clean-up
//
- auto err = GenericPlatformManagerImpl<ImplClass>::_Shutdown();
- if (err == CHIP_NO_ERROR)
- {
- mInitialized = false;
- mQueue.background(nullptr);
- }
- return err;
+ GenericPlatformManagerImpl<ImplClass>::_Shutdown();
+ mInitialized = false;
+ mQueue.background(nullptr);
}
CHIP_ERROR PlatformManagerImpl::TranslateOsStatus(osStatus error)
diff --git a/src/platform/mbed/PlatformManagerImpl.h b/src/platform/mbed/PlatformManagerImpl.h
index 59b1198..8eb2a36 100644
--- a/src/platform/mbed/PlatformManagerImpl.h
+++ b/src/platform/mbed/PlatformManagerImpl.h
@@ -89,7 +89,7 @@
CHIP_ERROR _StartEventLoopTask();
CHIP_ERROR _StopEventLoopTask();
CHIP_ERROR _StartChipTimer(System::Clock::Timeout duration);
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
void ProcessDeviceEvents();
diff --git a/src/platform/nxp/k32w/k32w0/BLEManagerImpl.h b/src/platform/nxp/k32w/k32w0/BLEManagerImpl.h
index 410dca8..1ff7ba1 100644
--- a/src/platform/nxp/k32w/k32w0/BLEManagerImpl.h
+++ b/src/platform/nxp/k32w/k32w0/BLEManagerImpl.h
@@ -64,7 +64,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp
index 95303b4..a25fe92 100644
--- a/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp
+++ b/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp
@@ -133,7 +133,7 @@
return err;
}
-CHIP_ERROR PlatformManagerImpl::_Shutdown()
+void PlatformManagerImpl::_Shutdown()
{
uint64_t upTime = 0;
@@ -155,7 +155,7 @@
ChipLogError(DeviceLayer, "Failed to get current uptime since the Node’s last reboot");
}
- return Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
+ Internal::GenericPlatformManagerImpl_FreeRTOS<PlatformManagerImpl>::_Shutdown();
}
} // namespace DeviceLayer
diff --git a/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.h b/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.h
index b9452e0..70ece1c 100644
--- a/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.h
+++ b/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.h
@@ -55,7 +55,7 @@
// ===== Methods that implement the PlatformManager abstract interface.
CHIP_ERROR _InitChipStack(void);
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
// ===== Members for internal use by the following friends.
diff --git a/src/platform/qpg/BLEManagerImpl.h b/src/platform/qpg/BLEManagerImpl.h
index 59998d5..b9ea6c9 100644
--- a/src/platform/qpg/BLEManagerImpl.h
+++ b/src/platform/qpg/BLEManagerImpl.h
@@ -48,7 +48,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; }
+ void _Shutdown() {}
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/telink/BLEManagerImpl.cpp b/src/platform/telink/BLEManagerImpl.cpp
index b3b48f9..68464a1 100644
--- a/src/platform/telink/BLEManagerImpl.cpp
+++ b/src/platform/telink/BLEManagerImpl.cpp
@@ -467,13 +467,6 @@
bls_att_setAttributeTable((u8 *) gattTable);
}
-CHIP_ERROR _Shutdown(void)
-{
- ChipLogProgress(DeviceLayer, "BLEManagerImpl::_Shutdown");
-
- return CHIP_NO_ERROR;
-}
-
CHIP_ERROR BLEManagerImpl::_SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val)
{
return CHIP_NO_ERROR;
diff --git a/src/platform/telink/BLEManagerImpl.h b/src/platform/telink/BLEManagerImpl.h
index d1b3d9f..e3a0f45 100644
--- a/src/platform/telink/BLEManagerImpl.h
+++ b/src/platform/telink/BLEManagerImpl.h
@@ -44,7 +44,7 @@
// Members that implement the BLEManager internal interface.
CHIP_ERROR _Init(void);
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled(void);
diff --git a/src/platform/tests/TestPlatformMgr.cpp b/src/platform/tests/TestPlatformMgr.cpp
index 363efbb..cd2caab 100644
--- a/src/platform/tests/TestPlatformMgr.cpp
+++ b/src/platform/tests/TestPlatformMgr.cpp
@@ -50,8 +50,7 @@
CHIP_ERROR err = PlatformMgr().InitChipStack();
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
- err = PlatformMgr().Shutdown();
- NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+ PlatformMgr().Shutdown();
}
static void TestPlatformMgr_BasicEventLoopTask(nlTestSuite * inSuite, void * inContext)
@@ -65,8 +64,7 @@
err = PlatformMgr().StopEventLoopTask();
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
- err = PlatformMgr().Shutdown();
- NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+ PlatformMgr().Shutdown();
}
static bool stopRan;
@@ -91,8 +89,7 @@
PlatformMgr().RunEventLoop();
NL_TEST_ASSERT(inSuite, stopRan);
- err = PlatformMgr().Shutdown();
- NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+ PlatformMgr().Shutdown();
}
static bool sleepRan;
@@ -118,8 +115,7 @@
NL_TEST_ASSERT(inSuite, stopRan);
NL_TEST_ASSERT(inSuite, sleepRan);
- err = PlatformMgr().Shutdown();
- NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+ PlatformMgr().Shutdown();
}
void StopAndSleep(intptr_t arg)
@@ -143,8 +139,7 @@
NL_TEST_ASSERT(inSuite, stopRan);
NL_TEST_ASSERT(inSuite, sleepRan);
- err = PlatformMgr().Shutdown();
- NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+ PlatformMgr().Shutdown();
}
static void TestPlatformMgr_TryLockChipStack(nlTestSuite * inSuite, void * inContext)
@@ -206,8 +201,7 @@
inSuite, DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::kZero, nullptr, nullptr) == CHIP_APPLICATION_ERROR(1));
NL_TEST_ASSERT(inSuite, DeviceLayer::SystemLayer().ScheduleWork(nullptr, nullptr) == CHIP_APPLICATION_ERROR(2));
- err = PlatformMgr().Shutdown();
- NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
+ PlatformMgr().Shutdown();
DeviceLayer::SetSystemLayerForTesting(nullptr);
}
diff --git a/src/platform/webos/BLEManagerImpl.cpp b/src/platform/webos/BLEManagerImpl.cpp
index e39a1f0..6b37fdf 100644
--- a/src/platform/webos/BLEManagerImpl.cpp
+++ b/src/platform/webos/BLEManagerImpl.cpp
@@ -128,12 +128,10 @@
return err;
}
-CHIP_ERROR BLEManagerImpl::_Shutdown()
+void BLEManagerImpl::_Shutdown()
{
// ensure scan resources are cleared (e.g. timeout timers)
mDeviceScanner.reset();
-
- return CHIP_NO_ERROR;
}
CHIP_ERROR BLEManagerImpl::_SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val)
diff --git a/src/platform/webos/BLEManagerImpl.h b/src/platform/webos/BLEManagerImpl.h
index 8b04ba4..e4f20dd 100644
--- a/src/platform/webos/BLEManagerImpl.h
+++ b/src/platform/webos/BLEManagerImpl.h
@@ -95,7 +95,7 @@
// ===== Members that implement the BLEManager internal interface.
CHIP_ERROR _Init();
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
CHIPoBLEServiceMode _GetCHIPoBLEServiceMode();
CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
bool _IsAdvertisingEnabled();
diff --git a/src/platform/webos/DnssdImpl.cpp b/src/platform/webos/DnssdImpl.cpp
index 3f5b525..3898325 100644
--- a/src/platform/webos/DnssdImpl.cpp
+++ b/src/platform/webos/DnssdImpl.cpp
@@ -342,7 +342,7 @@
return error;
}
-CHIP_ERROR MdnsAvahi::Shutdown()
+void MdnsAvahi::Shutdown()
{
if (mGroup)
{
@@ -354,7 +354,6 @@
avahi_client_free(mClient);
mClient = nullptr;
}
- return CHIP_NO_ERROR;
}
CHIP_ERROR MdnsAvahi::SetHostname(const char * hostname)
@@ -820,9 +819,9 @@
return MdnsAvahi::GetInstance().Init(initCallback, errorCallback, context);
}
-CHIP_ERROR ChipDnssdShutdown()
+void ChipDnssdShutdown()
{
- return MdnsAvahi::GetInstance().Shutdown();
+ MdnsAvahi::GetInstance().Shutdown();
}
CHIP_ERROR ChipDnssdPublishService(const DnssdService * service, DnssdPublishCallback callback, void * context)
diff --git a/src/platform/webos/DnssdImpl.h b/src/platform/webos/DnssdImpl.h
index ffc6d47..e711180 100644
--- a/src/platform/webos/DnssdImpl.h
+++ b/src/platform/webos/DnssdImpl.h
@@ -105,7 +105,7 @@
MdnsAvahi & operator=(const MdnsAvahi &) = delete;
CHIP_ERROR Init(DnssdAsyncReturnCallback initCallback, DnssdAsyncReturnCallback errorCallback, void * context);
- CHIP_ERROR Shutdown();
+ void Shutdown();
CHIP_ERROR SetHostname(const char * hostname);
CHIP_ERROR PublishService(const DnssdService & service, DnssdPublishCallback callback, void * context);
CHIP_ERROR StopPublish();
diff --git a/src/platform/webos/NetworkCommissioningDriver.h b/src/platform/webos/NetworkCommissioningDriver.h
index a474535..330f1b6 100644
--- a/src/platform/webos/NetworkCommissioningDriver.h
+++ b/src/platform/webos/NetworkCommissioningDriver.h
@@ -80,7 +80,7 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new WiFiNetworkIterator(this); }
CHIP_ERROR Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) override;
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
// WirelessDriver
uint8_t GetMaxNetworks() override { return 1; }
@@ -130,7 +130,7 @@
// BaseDriver
NetworkIterator * GetNetworks() override { return new ThreadNetworkIterator(this); }
CHIP_ERROR Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) override;
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
// WirelessDriver
uint8_t GetMaxNetworks() override { return 1; }
diff --git a/src/platform/webos/NetworkCommissioningThreadDriver.cpp b/src/platform/webos/NetworkCommissioningThreadDriver.cpp
index 776d12e..fbc7e68 100644
--- a/src/platform/webos/NetworkCommissioningThreadDriver.cpp
+++ b/src/platform/webos/NetworkCommissioningThreadDriver.cpp
@@ -53,10 +53,9 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR LinuxThreadDriver::Shutdown()
+void LinuxThreadDriver::Shutdown()
{
ThreadStackMgrImpl().SetNetworkStatusChangeCallback(nullptr);
- return CHIP_NO_ERROR;
}
CHIP_ERROR LinuxThreadDriver::CommitConfiguration()
diff --git a/src/platform/webos/NetworkCommissioningWiFiDriver.cpp b/src/platform/webos/NetworkCommissioningWiFiDriver.cpp
index be181f2..9230572 100644
--- a/src/platform/webos/NetworkCommissioningWiFiDriver.cpp
+++ b/src/platform/webos/NetworkCommissioningWiFiDriver.cpp
@@ -78,10 +78,9 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR LinuxWiFiDriver::Shutdown()
+void LinuxWiFiDriver::Shutdown()
{
ConnectivityMgrImpl().SetNetworkStatusChangeCallback(nullptr);
- return CHIP_NO_ERROR;
}
CHIP_ERROR LinuxWiFiDriver::CommitConfiguration()
diff --git a/src/platform/webos/PlatformManagerImpl.cpp b/src/platform/webos/PlatformManagerImpl.cpp
index a2e7254..50cfbbc 100644
--- a/src/platform/webos/PlatformManagerImpl.cpp
+++ b/src/platform/webos/PlatformManagerImpl.cpp
@@ -177,7 +177,7 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR PlatformManagerImpl::_Shutdown()
+void PlatformManagerImpl::_Shutdown()
{
uint64_t upTime = 0;
@@ -199,7 +199,7 @@
ChipLogError(DeviceLayer, "Failed to get current uptime since the Node’s last reboot");
}
- return Internal::GenericPlatformManagerImpl_POSIX<PlatformManagerImpl>::_Shutdown();
+ Internal::GenericPlatformManagerImpl_POSIX<PlatformManagerImpl>::_Shutdown();
}
#if CHIP_WITH_GIO
diff --git a/src/platform/webos/PlatformManagerImpl.h b/src/platform/webos/PlatformManagerImpl.h
index bdb6f4d..9594cff 100644
--- a/src/platform/webos/PlatformManagerImpl.h
+++ b/src/platform/webos/PlatformManagerImpl.h
@@ -60,7 +60,7 @@
// ===== Methods that implement the PlatformManager abstract interface.
CHIP_ERROR _InitChipStack();
- CHIP_ERROR _Shutdown();
+ void _Shutdown();
// ===== Members for internal use by the following friends.
diff --git a/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp b/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp
index 3746eb8..c2e7159 100644
--- a/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp
+++ b/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp
@@ -158,8 +158,8 @@
*/
int Finalize(void * aContext)
{
- CHIP_ERROR err = reinterpret_cast<TestContext *>(aContext)->Shutdown();
- return (err == CHIP_NO_ERROR) ? SUCCESS : FAILURE;
+ reinterpret_cast<TestContext *>(aContext)->Shutdown();
+ return SUCCESS;
}
} // namespace
diff --git a/src/system/SystemLayer.h b/src/system/SystemLayer.h
index 3a91b99..d312d67 100644
--- a/src/system/SystemLayer.h
+++ b/src/system/SystemLayer.h
@@ -86,7 +86,7 @@
* Some other layers hold pointers to System::Layer, so care must be taken
* to ensure that they are not used after calling Shutdown().
*/
- virtual CHIP_ERROR Shutdown() = 0;
+ virtual void Shutdown() = 0;
/**
* True if this Layer is initialized. No method on Layer or its abstract descendants, other than this and `Init()`,
diff --git a/src/system/SystemLayerImplFreeRTOS.cpp b/src/system/SystemLayerImplFreeRTOS.cpp
index b78e803..79d892b 100644
--- a/src/system/SystemLayerImplFreeRTOS.cpp
+++ b/src/system/SystemLayerImplFreeRTOS.cpp
@@ -44,10 +44,9 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR LayerImplFreeRTOS::Shutdown()
+void LayerImplFreeRTOS::Shutdown()
{
- VerifyOrReturnError(mLayerState.ResetFromInitialized(), CHIP_ERROR_INCORRECT_STATE);
- return CHIP_NO_ERROR;
+ mLayerState.ResetFromInitialized();
}
CHIP_ERROR LayerImplFreeRTOS::StartTimer(Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState)
diff --git a/src/system/SystemLayerImplFreeRTOS.h b/src/system/SystemLayerImplFreeRTOS.h
index 2220eb3..846e17b 100644
--- a/src/system/SystemLayerImplFreeRTOS.h
+++ b/src/system/SystemLayerImplFreeRTOS.h
@@ -37,7 +37,7 @@
// Layer overrides.
CHIP_ERROR Init() override;
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
bool IsInitialized() const override { return mLayerState.IsInitialized(); }
CHIP_ERROR StartTimer(Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState) override;
void CancelTimer(TimerCompleteCallback onComplete, void * appState) override;
diff --git a/src/system/SystemLayerImplSelect.cpp b/src/system/SystemLayerImplSelect.cpp
index 96e0907..bd2e806 100644
--- a/src/system/SystemLayerImplSelect.cpp
+++ b/src/system/SystemLayerImplSelect.cpp
@@ -62,9 +62,9 @@
return CHIP_NO_ERROR;
}
-CHIP_ERROR LayerImplSelect::Shutdown()
+void LayerImplSelect::Shutdown()
{
- VerifyOrReturnError(mLayerState.SetShuttingDown(), CHIP_ERROR_INCORRECT_STATE);
+ VerifyOrReturn(mLayerState.SetShuttingDown());
#if CHIP_SYSTEM_CONFIG_USE_DISPATCH
TimerList::Node * timer;
@@ -85,7 +85,6 @@
mWakeEvent.Close(*this);
mLayerState.ResetFromShuttingDown(); // Return to uninitialized state to permit re-initialization.
- return CHIP_NO_ERROR;
}
void LayerImplSelect::Signal()
diff --git a/src/system/SystemLayerImplSelect.h b/src/system/SystemLayerImplSelect.h
index 5a63147..338214c 100644
--- a/src/system/SystemLayerImplSelect.h
+++ b/src/system/SystemLayerImplSelect.h
@@ -45,7 +45,7 @@
// Layer overrides.
CHIP_ERROR Init() override;
- CHIP_ERROR Shutdown() override;
+ void Shutdown() override;
bool IsInitialized() const override { return mLayerState.IsInitialized(); }
CHIP_ERROR StartTimer(Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState) override;
void CancelTimer(TimerCompleteCallback onComplete, void * appState) override;
diff --git a/src/system/tests/TestSystemPacketBuffer.cpp b/src/system/tests/TestSystemPacketBuffer.cpp
index b66c766..d3c7bc3 100644
--- a/src/system/tests/TestSystemPacketBuffer.cpp
+++ b/src/system/tests/TestSystemPacketBuffer.cpp
@@ -231,10 +231,7 @@
int PacketBufferTest::TestTeardown(void * inContext)
{
- CHIP_ERROR err = chip::DeviceLayer::PlatformMgr().Shutdown();
- // RTOS shutdown is not implemented, ignore CHIP_ERROR_NOT_IMPLEMENTED
- if (err != CHIP_NO_ERROR && err != CHIP_ERROR_NOT_IMPLEMENTED)
- return FAILURE;
+ chip::DeviceLayer::PlatformMgr().Shutdown();
chip::Platform::MemoryShutdown();
diff --git a/src/system/tests/TestSystemScheduleLambda.cpp b/src/system/tests/TestSystemScheduleLambda.cpp
index 3ee8a99..db43fcf 100644
--- a/src/system/tests/TestSystemScheduleLambda.cpp
+++ b/src/system/tests/TestSystemScheduleLambda.cpp
@@ -79,11 +79,7 @@
*/
static int TestTeardown(void * aContext)
{
- CHIP_ERROR err = chip::DeviceLayer::PlatformMgr().Shutdown();
- // RTOS shutdown is not implemented, ignore CHIP_ERROR_NOT_IMPLEMENTED
- if (err != CHIP_NO_ERROR && err != CHIP_ERROR_NOT_IMPLEMENTED)
- return FAILURE;
-
+ chip::DeviceLayer::PlatformMgr().Shutdown();
return (SUCCESS);
}
diff --git a/src/transport/raw/tests/NetworkTestHelpers.cpp b/src/transport/raw/tests/NetworkTestHelpers.cpp
index cf97220..e21c022 100644
--- a/src/transport/raw/tests/NetworkTestHelpers.cpp
+++ b/src/transport/raw/tests/NetworkTestHelpers.cpp
@@ -44,15 +44,11 @@
}
// Shutdown all layers, finalize operations
-CHIP_ERROR IOContext::Shutdown()
+void IOContext::Shutdown()
{
- CHIP_ERROR err = CHIP_NO_ERROR;
-
ShutdownNetwork();
ShutdownSystemLayer();
Platform::MemoryShutdown();
-
- return err;
}
void IOContext::DriveIO()
diff --git a/src/transport/raw/tests/NetworkTestHelpers.h b/src/transport/raw/tests/NetworkTestHelpers.h
index a0cb296..bbf3fcb 100644
--- a/src/transport/raw/tests/NetworkTestHelpers.h
+++ b/src/transport/raw/tests/NetworkTestHelpers.h
@@ -40,7 +40,7 @@
CHIP_ERROR Init();
// Shutdown all layers, finalize operations
- CHIP_ERROR Shutdown();
+ void Shutdown();
/// Perform a single short IO Loop
void DriveIO();
diff --git a/src/transport/raw/tests/TestTCP.cpp b/src/transport/raw/tests/TestTCP.cpp
index ef15818..62b03f4 100644
--- a/src/transport/raw/tests/TestTCP.cpp
+++ b/src/transport/raw/tests/TestTCP.cpp
@@ -497,8 +497,8 @@
*/
static int Finalize(void * aContext)
{
- CHIP_ERROR err = reinterpret_cast<TestContext *>(aContext)->Shutdown();
- return (err == CHIP_NO_ERROR) ? SUCCESS : FAILURE;
+ reinterpret_cast<TestContext *>(aContext)->Shutdown();
+ return SUCCESS;
}
int TestTCP()
diff --git a/src/transport/raw/tests/TestUDP.cpp b/src/transport/raw/tests/TestUDP.cpp
index e556f20..bff5e9e 100644
--- a/src/transport/raw/tests/TestUDP.cpp
+++ b/src/transport/raw/tests/TestUDP.cpp
@@ -205,8 +205,8 @@
*/
static int Finalize(void * aContext)
{
- CHIP_ERROR err = reinterpret_cast<TestContext *>(aContext)->Shutdown();
- return (err == CHIP_NO_ERROR) ? SUCCESS : FAILURE;
+ reinterpret_cast<TestContext *>(aContext)->Shutdown();
+ return SUCCESS;
}
int TestUDP()
diff --git a/src/transport/tests/LoopbackTransportManager.h b/src/transport/tests/LoopbackTransportManager.h
index df44e5d..1ee6f8c 100644
--- a/src/transport/tests/LoopbackTransportManager.h
+++ b/src/transport/tests/LoopbackTransportManager.h
@@ -36,11 +36,10 @@
}
// Shutdown all layers, finalize operations
- CHIP_ERROR Shutdown()
+ void Shutdown()
{
GetLoopback().ShutdownLoopbackTransport();
- ReturnErrorOnFailure(mIOContext.Shutdown());
- return CHIP_NO_ERROR;
+ mIOContext.Shutdown();
}
System::Layer & GetSystemLayer() { return mIOContext.GetSystemLayer(); }
diff --git a/src/transport/tests/TestSessionManager.cpp b/src/transport/tests/TestSessionManager.cpp
index 99cce95..45c5468 100644
--- a/src/transport/tests/TestSessionManager.cpp
+++ b/src/transport/tests/TestSessionManager.cpp
@@ -1004,8 +1004,8 @@
*/
int Finalize(void * aContext)
{
- CHIP_ERROR err = reinterpret_cast<TestContext *>(aContext)->Shutdown();
- return (err == CHIP_NO_ERROR) ? SUCCESS : FAILURE;
+ reinterpret_cast<TestContext *>(aContext)->Shutdown();
+ return SUCCESS;
}
} // namespace