-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert mdns Builder classes to use PacketBufferHandle #4094
Convert mdns Builder classes to use PacketBufferHandle #4094
Conversation
#### Problem Code should use `PacketBufferHandle` rather than `PacketBuffer` directly. #### Summary of Changes Convert mdns::Minimal::QueryBuilder and mdns::Minimal::ResponseBuilder to take and hold PacketBufferHandle. Part of issue project-chip#2707 - Figure out a way to express PacketBuffer ownership in the type system
examples/minimal-mdns/client.cpp
Outdated
@@ -213,7 +213,7 @@ void BroadcastPacket(mdns::Minimal::ServerBase * server) | |||
QuerySplitter query; | |||
query.Split(gOptions.query); | |||
|
|||
mdns::Minimal::QueryBuilder builder(buffer.Get_ForNow()); | |||
mdns::Minimal::QueryBuilder builder(buffer.Retain()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. It seems like we could make the builder take a const ref to PacketBufferHandle (and have its member be a const ref) and avoid the extra refcounting And here we could scope it so it goes out of scope before we do the BroadcastSend
call...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes. I probably had TLV's chaining in mind when I converted this one. Fixed.
@kpschoedel Merge conflicts? |
also #4102 has some conversions to PacketBufferHandle (not sure if the same, but if we could make them similar it may be easier to merge) |
…4094) * Convert mdns Builder classes to use PacketBufferHandle #### Problem Code should use `PacketBufferHandle` rather than `PacketBuffer` directly. #### Summary of Changes Convert mdns::Minimal::QueryBuilder and mdns::Minimal::ResponseBuilder to take and hold PacketBufferHandle. Part of issue project-chip#2707 - Figure out a way to express PacketBuffer ownership in the type system * Review: make QueryBuilder take const& * WIP * Revise to match ResponseBuilder in project-chip#4102 * Restyled by clang-format * remove PacketReporter.cpp change Co-authored-by: Restyled.io <[email protected]>
Problem
Code should use
PacketBufferHandle
rather thanPacketBuffer
directly.
Summary of Changes
Convert mdns::Minimal::QueryBuilder and mdns::Minimal::ResponseBuilder
to take and hold PacketBufferHandle.
Part of issue #2707 - Figure out a way to express PacketBuffer ownership in the type system