Skip to content

Commit

Permalink
Use undefined fabric index as an invalid marker
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Feb 9, 2022
1 parent 7a3f094 commit 2296d37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/credentials/FabricTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@

namespace chip {

static constexpr FabricIndex kInvalidFabricIndex = 0;
static constexpr FabricIndex kMinValidFabricIndex = 1;
static constexpr FabricIndex kMaxValidFabricIndex = std::min<FabricIndex>(UINT8_MAX - 1, CHIP_CONFIG_MAX_FABRICS);
static constexpr uint8_t kFabricLabelMaxLengthInBytes = 32;

static_assert(kInvalidFabricIndex < chip::kMinValidFabricIndex, "Invalid fabric index must be invalid");
static_assert(kUndefinedFabricIndex < chip::kMinValidFabricIndex, "Undefined fabric index should not be valid");

// KVS store is sensitive to length of key strings, based on the underlying
// platform. Keeping them short.
Expand Down
2 changes: 1 addition & 1 deletion src/transport/Session.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Session

private:
IntrusiveList<SessionHolder> mHolders;
FabricIndex mFabricIndex = kInvalidFabricIndex;
FabricIndex mFabricIndex = kUndefinedFabricIndex;
};

} // namespace Transport
Expand Down

0 comments on commit 2296d37

Please sign in to comment.