[message] add clone methods to MessageAllocator - #12704
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new MessageAllocator class to simplify message creation and cloning, which is a great improvement for code clarity and maintainability. The changes mostly involve adopting this new abstraction across the codebase. The implementation of MessageAllocator looks solid, but I've found a couple of issues. There's a missing header include in the new message_allocator.hpp file which would cause a compilation error. Additionally, a change in nat64_translator.cpp seems to incorrectly reduce the reserved message space, which could lead to runtime failures during IPv4-to-IPv6 translation. I've provided suggestions to address both issues.
Library files
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12704 +/- ##
==========================================
- Coverage 70.60% 69.48% -1.12%
==========================================
Files 665 697 +32
Lines 90533 93487 +2954
==========================================
+ Hits 63921 64964 +1043
- Misses 26612 28523 +1911
🚀 New features to boost your workflow:
|
c5238eb to
9cf8a1f
Compare
MessageAllocatorMessageAllocator
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces new CloneMessage(), CloneMessageWithoutFooter(), and CloneMessageWithout<Footer>() methods to the MessageAllocator class, simplifying message copying with automatic kReservedHeader size application. It also updates existing code in CoapBase, Dns::Client, Sntp::Client, and Mle to utilize these new methods. Additionally, the Clone() method in Message is updated to be a template method, accepting a CloneMode to specify whether the cloned message should retain the reserved header or have no reserved header. The documentation for the clone methods has also been updated to clarify which message fields are copied during the cloning process. The review focuses on correctness and maintainability, ensuring the new methods are used appropriately and the code adheres to the project's coding style.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces new CloneMessage(), CloneMessageWithoutFooter(), and CloneMessageWithout<Footer>() methods to the MessageAllocator class for simplifying message copying with correct header sizes. It also updates existing code in CoapBase, Dns::Client, Sntp::Client, and Mle to utilize these new methods. Additionally, the Clone() method in Message is updated to be a template method, accepting a CloneMode to specify whether the cloned message should retain the reserved header or have no reserved header. The documentation for the clone methods has also been updated to clarify which message fields are copied during the cloning process. The review focuses on correctness and maintainability, ensuring proper usage of the new clone methods and adherence to the project's coding style, as defined in the repository's style guide.
|
@abtink , can you help resolve conflicts? |
This commit adds `CloneMessage()`, `CloneMessageWithoutFooter()`, and `CloneMessageWithout<Footer>()` methods to the `MessageAllocator` class. These methods simplify creating copies of messages by automatically applying the correct `kReservedHeader` size. It also updates existing code in `CoapBase`, `Dns::Client`, `Sntp::Client`, and `Mle` to utilize these new methods. Additionally, this commit updates the `Clone()` method in `Message` to be a template method, accepting a `CloneMode` to specify whether the cloned message should retain the reserved header or have no reserved header. The documentation for the clone methods has also been updated to clarify which message fields are copied during the cloning process.
9cf8a1f to
4936841
Compare
This commit adds
CloneMessage(),CloneMessageWithoutFooter(), andCloneMessageWithout<Footer>()methods to theMessageAllocatorclass. These methods simplify creating copies of messages by automatically applying the correctkReservedHeadersize. It also updates existing code inCoapBase,Dns::Client,Sntp::Client, andMleto utilize these new methods.Additionally, this commit updates the
Clone()method inMessageto be a template method, accepting aCloneModeto specify whether the cloned message should retain the reserved header or have no reserved header. The documentation for the clone methods has also been updated to clarify which message fields are copied during the cloning process.