Skip to content

Commit

Permalink
Fix shutdown ordering in Echo requester/responder (#7509)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored Jun 10, 2021
1 parent d29749b commit 707a825
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/messaging/tests/echo/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <protocols/secure_channel/MessageCounterManager.h>
#include <support/ErrorStr.h>

// The ExchangeManager global object.
chip::SecureSessionMgr gSessionManager;
chip::Messaging::ExchangeManager gExchangeManager;
chip::secure_channel::MessageCounterManager gMessageCounterManager;

Expand Down Expand Up @@ -58,6 +58,8 @@ void InitializeChip(void)

void ShutdownChip(void)
{
gExchangeManager.Shutdown();
chip::DeviceLayer::PlatformMgr().Shutdown();
gMessageCounterManager.Shutdown();
gExchangeManager.Shutdown();
gSessionManager.Shutdown();
}
2 changes: 2 additions & 0 deletions src/messaging/tests/echo/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@

#include <messaging/ExchangeMgr.h>
#include <protocols/secure_channel/MessageCounterManager.h>
#include <transport/SecureSessionMgr.h>

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;

Expand Down
2 changes: 0 additions & 2 deletions src/messaging/tests/echo/echo_requester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <protocols/secure_channel/PASESession.h>
#include <support/ErrorStr.h>
#include <system/SystemPacketBuffer.h>
#include <transport/SecureSessionMgr.h>
#include <transport/raw/TCP.h>
#include <transport/raw/UDP.h>

Expand All @@ -60,7 +59,6 @@ chip::Protocols::Echo::EchoClient gEchoClient;

chip::TransportMgr<chip::Transport::UDP> gUDPManager;
chip::TransportMgr<chip::Transport::TCP<kMaxTcpActiveConnectionCount, kMaxTcpPendingPackets>> gTCPManager;
chip::SecureSessionMgr gSessionManager;
chip::Inet::IPAddress gDestAddr;

// The last time a CHIP Echo was attempted to be sent.
Expand Down
2 changes: 0 additions & 2 deletions src/messaging/tests/echo/echo_responder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <protocols/secure_channel/PASESession.h>
#include <support/ErrorStr.h>
#include <system/SystemPacketBuffer.h>
#include <transport/SecureSessionMgr.h>
#include <transport/raw/TCP.h>
#include <transport/raw/UDP.h>

Expand All @@ -45,7 +44,6 @@ namespace {
chip::Protocols::Echo::EchoServer gEchoServer;
chip::TransportMgr<chip::Transport::UDP> gUDPManager;
chip::TransportMgr<chip::Transport::TCP<kMaxTcpActiveConnectionCount, kMaxTcpPendingPackets>> gTCPManager;
chip::SecureSessionMgr gSessionManager;
chip::SecurePairingUsingTestSecret gTestPairing;

// Callback handler when a CHIP EchoRequest is received.
Expand Down

0 comments on commit 707a825

Please sign in to comment.