From 707a8253cec4a7a4ce3344c0687ad1d2dfb2b468 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Thu, 10 Jun 2021 15:10:34 -0700 Subject: [PATCH] Fix shutdown ordering in Echo requester/responder (#7509) --- src/messaging/tests/echo/common.cpp | 6 ++++-- src/messaging/tests/echo/common.h | 2 ++ src/messaging/tests/echo/echo_requester.cpp | 2 -- src/messaging/tests/echo/echo_responder.cpp | 2 -- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/messaging/tests/echo/common.cpp b/src/messaging/tests/echo/common.cpp index 280685f231749d..75a4d7d0e391d6 100644 --- a/src/messaging/tests/echo/common.cpp +++ b/src/messaging/tests/echo/common.cpp @@ -30,7 +30,7 @@ #include #include -// The ExchangeManager global object. +chip::SecureSessionMgr gSessionManager; chip::Messaging::ExchangeManager gExchangeManager; chip::secure_channel::MessageCounterManager gMessageCounterManager; @@ -58,6 +58,8 @@ void InitializeChip(void) void ShutdownChip(void) { - gExchangeManager.Shutdown(); chip::DeviceLayer::PlatformMgr().Shutdown(); + gMessageCounterManager.Shutdown(); + gExchangeManager.Shutdown(); + gSessionManager.Shutdown(); } diff --git a/src/messaging/tests/echo/common.h b/src/messaging/tests/echo/common.h index cb38a93644d7a6..652cd890970f5e 100644 --- a/src/messaging/tests/echo/common.h +++ b/src/messaging/tests/echo/common.h @@ -26,11 +26,13 @@ #include #include +#include constexpr size_t kMaxTcpActiveConnectionCount = 4; constexpr size_t kMaxTcpPendingPackets = 4; constexpr size_t kNetworkSleepTimeMsecs = (100 * 1000); +extern chip::SecureSessionMgr gSessionManager; extern chip::Messaging::ExchangeManager gExchangeManager; extern chip::secure_channel::MessageCounterManager gMessageCounterManager; diff --git a/src/messaging/tests/echo/echo_requester.cpp b/src/messaging/tests/echo/echo_requester.cpp index 2e100386b97d3b..0efcc71a1e43de 100644 --- a/src/messaging/tests/echo/echo_requester.cpp +++ b/src/messaging/tests/echo/echo_requester.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -60,7 +59,6 @@ chip::Protocols::Echo::EchoClient gEchoClient; chip::TransportMgr gUDPManager; chip::TransportMgr> gTCPManager; -chip::SecureSessionMgr gSessionManager; chip::Inet::IPAddress gDestAddr; // The last time a CHIP Echo was attempted to be sent. diff --git a/src/messaging/tests/echo/echo_responder.cpp b/src/messaging/tests/echo/echo_responder.cpp index 32dff139291017..edfd6d57134ed3 100644 --- a/src/messaging/tests/echo/echo_responder.cpp +++ b/src/messaging/tests/echo/echo_responder.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -45,7 +44,6 @@ namespace { chip::Protocols::Echo::EchoServer gEchoServer; chip::TransportMgr gUDPManager; chip::TransportMgr> gTCPManager; -chip::SecureSessionMgr gSessionManager; chip::SecurePairingUsingTestSecret gTestPairing; // Callback handler when a CHIP EchoRequest is received.