From ead181f35fc05e7bc2d3c32f6855674f0c26da9f Mon Sep 17 00:00:00 2001 From: WanqQixiang Date: Tue, 7 Jan 2025 16:09:43 +0800 Subject: [PATCH] move RunOnMatterContext to LayerFreeRTOS --- src/inet/TCPEndPointImplLwIP.cpp | 6 +++--- src/system/SystemLayer.cpp | 4 +++- src/system/SystemLayer.h | 3 +-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/inet/TCPEndPointImplLwIP.cpp b/src/inet/TCPEndPointImplLwIP.cpp index 2d991fcf295565..9eccddfe6be0ad 100644 --- a/src/inet/TCPEndPointImplLwIP.cpp +++ b/src/inet/TCPEndPointImplLwIP.cpp @@ -788,9 +788,9 @@ err_t TCPEndPointImplLwIP::LwIPHandleIncomingConnection(void * arg, struct tcp_p if (arg != nullptr) { - TCPEndPointImplLwIP * listenEP = static_cast(arg); - TCPEndPointImplLwIP * conEP = nullptr; - System::Layer & lSystemLayer = listenEP->GetSystemLayer(); + TCPEndPointImplLwIP * listenEP = static_cast(arg); + TCPEndPointImplLwIP * conEP = nullptr; + System::LayerFreeRTOS & lSystemLayer = static_cast(istenEP->GetSystemLayer()); // Tell LwIP we've accepted the connection so it can decrement the listen PCB's pending_accepts counter. tcp_accepted(listenEP->mTCP); diff --git a/src/system/SystemLayer.cpp b/src/system/SystemLayer.cpp index cdaf6096d3eda7..5d2c6a8fe0f80d 100644 --- a/src/system/SystemLayer.cpp +++ b/src/system/SystemLayer.cpp @@ -31,7 +31,8 @@ CHIP_ERROR Layer::ScheduleLambdaBridge(LambdaBridge && bridge) return lReturn; } -CHIP_ERROR Layer::RunOnMatterContext(std::function func) +#if CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT +CHIP_ERROR LayerFreeRTOS::RunOnMatterContext(std::function func) { CHIP_ERROR err = CHIP_NO_ERROR; PlatformEventing::LockMatterStack(*this); @@ -39,6 +40,7 @@ CHIP_ERROR Layer::RunOnMatterContext(std::function func) PlatformEventing::UnlockMatterStack(*this); return err; } +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP || CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT } // namespace System } // namespace chip diff --git a/src/system/SystemLayer.h b/src/system/SystemLayer.h index b5d9068433b2ca..8742b3d85613d3 100644 --- a/src/system/SystemLayer.h +++ b/src/system/SystemLayer.h @@ -220,8 +220,6 @@ class DLL_EXPORT Layer return ScheduleLambdaBridge(std::move(bridge)); } - CHIP_ERROR RunOnMatterContext(std::function); - private: CHIP_ERROR ScheduleLambdaBridge(LambdaBridge && bridge); @@ -234,6 +232,7 @@ class DLL_EXPORT Layer class LayerFreeRTOS : public Layer { + CHIP_ERROR RunOnMatterContext(std::function); }; #endif // CHIP_SYSTEM_CONFIG_USE_LWIP