forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce use of maximum-sized packet buffers (project-chip#4434)
* Reduce use of maximum-sized packet buffers CHIP code contains many uses of PacketBuffer::New(), which allocates a maximum-size buffer. This is often much larger than actually required, which wastes heap. - Replaced `PacketBuffer::New()` and `NewWithAvailableSize()` with `PacketBufferHandle::New()`, which requires an explicit packet size. (The parameter order is opposite to the old `NewWithAvailableSize()` because the reserved size is usually the default.) Made the available parameter a `size_t` because for many callers it originates as such, and `New()` already checks it; this allows removing `CanCastTo` tests from callers. Also, documented the guarantee that `New()` never returns a buffer with less space than requested, and removed post-New size tests. - Added `NewWithData()` to encapsulate a common use of `New()`, and reduce the risk of length errors between the steps. - Implemented `RightSize()` for the heap allocation case. - Added constants `kMaxPacketBufferSizeWithoutReserve` and `kMaxPacketBufferSize` for use where the maximum size is required or the size is unknown. - Added `kMaxIPAddressStringLength` for `NetworkProvisioning::SendIPAddress`. - Added `NetworkProvisioning::EncodedStringSize()` for `SendNetworkCredentials()`. - Moved some size constants into BLE header files. fixes project-chip#4351 - Reduce use of maximum-sized packet buffers * Fix merge of remote-tracking branch 'origin/master' into x4351-new * review * restyled
- Loading branch information
1 parent
01ac6e9
commit 9227a77
Showing
52 changed files
with
563 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.