Skip to content

Commit

Permalink
Workaround for project-chip#12821, session ID collissions
Browse files Browse the repository at this point in the history
Add a central session ID allocator in mSystemState so aware consumers
can avoid collision.
  • Loading branch information
msandstedt committed Dec 22, 2021
1 parent d666b4b commit c6df923
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/transport/SessionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <lib/support/DLLUtil.h>
#include <messaging/ReliableMessageProtocolConfig.h>
#include <protocols/secure_channel/Constants.h>
#include <protocols/secure_channel/SessionIDAllocator.h>
#include <transport/CryptoContext.h>
#include <transport/MessageCounterManagerInterface.h>
#include <transport/SecureSessionTable.h>
Expand Down Expand Up @@ -247,6 +248,12 @@ class DLL_EXPORT SessionManager : public TransportMgrDelegate
// and tv-casting-app that uses the TV's node ID to find the associated secure session
SessionHandle FindSecureSessionForNode(NodeId peerNodeId);

/**
* @brief
* Return the session ID allocator for this session manager instance.
*/
SessionIDAllocator * GetSessionIDAllocator() { return &mIDAllocator; }

private:
/**
* The State of a secure transport object.
Expand All @@ -263,6 +270,8 @@ class DLL_EXPORT SessionManager : public TransportMgrDelegate
kPayloadIsUnencrypted,
};

SessionIDAllocator mIDAllocator;

System::Layer * mSystemLayer = nullptr;
Transport::UnauthenticatedSessionTable<CHIP_CONFIG_UNAUTHENTICATED_CONNECTION_POOL_SIZE> mUnauthenticatedSessions;
Transport::SecureSessionTable<CHIP_CONFIG_PEER_CONNECTION_POOL_SIZE> mSecureSessions; // < Active connections to other peers
Expand Down

0 comments on commit c6df923

Please sign in to comment.