-
Notifications
You must be signed in to change notification settings - Fork 845
combine UDPPacket and UDPPacketInternal #9424
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
Conversation
| // associated continuation cancels a packet, we rest lastPktStartTime to be | ||
| // the same as the lastSentPktStartTime. | ||
| uint64_t lastSentPktStartTime = 0; | ||
| uint64_t lastPktStartTime = 0; |
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.
This was moved from UDPConnectionInternal to avoid having the Internal class in UDPPacket.
|
[approve ci autest] |
|
Verified that UDPPacket is currently never directly instantiated: #9470 . |
|
Here are the source files that reference Here are the source files that reference So there is some scoping that is lost by combining the classes. Why is this scoping of no value, or what outweighs the value of it. |
|
There is nothing to encapsulate and the only virtual function was free(which is only to support the unnecessary inheritance) so I don't see any reason for inheritance here. |
|
Yes there is no class or namespace scoping, but looks like there is some file scoping. Good C++ avoids reliance on file scoping, but this is trafficserver (C wannabe). Just seems like something to consider before we throw it away. |
|
I can't be certain but it seems like the P vs I files were split up to accommodate the |
|
I've identified a specific potential gain. If you feel I'm being unreasonable, I'd be fine if you found a different reviewer. |
bneradt
left a comment
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.
I've thought about this for a while and I'm coming to the conviction that you are both making true statements:
- You (Chris) are right that inheritance is not correct for this. Nothing of the interface of
UDPPacketis extended byUDPPacketInternalsinceUDPPacketInternalis a member-only class. Further, theUDPPacketInternalis always the only allocated class, with the "internal" stuff being accessed via a cast fromUDPPacket. This is kind of strange. - @ywkaras is right that these classes are intentionally divided via internal and external designs. This can be seen by looking at the uses of all the members of
UDPPacketInternal. BothpktLengthandsegment_size, for instance, are in no external code. They are inUDPPacketInternaland are only used iniocore/net/UnixUDPNet.cc. The same is true forchainanddelivery_time. In fact I think all the members ofUDPPacketInternal, if I'm scanning things correctly, are used in "implementation" code, that is inP_headers orUnixUDPConnection.ccorUnixUDPNet.ccfiles. This interface and implementation distinction is valuable.
My suggestion, rather than combining the classes, would rather be to convert the classes from an inheritance relationship to a containment relationship where UDPPacket contains a UDPPacketInternal class. This would satisfy both your observations.
|
That would have the same problem I think. The contents of UdpPacketInternal would be visible in files where it is not currently visible (loss of scoping). |
Part of the cleanup intent was to combine the scoping so I'm not sure why that keeps coming up. I can restore the details as a separate class and fixup the visibility but there is a cost (code complexity and runtime) to having the separate scope that I don't want to restore. |
|
To me code with less scoping is harder to understand. But it's true that, with this weird form of scoping, there is a small performance penalty. |
|
I don't think we are at a good stage to redesign / optimize the structure, because we'll have changes for recvmmsg and maybe also io_uring. I'd say making the structure simple is a good first step for future changes. |
|
Sounds like I just got outvoted. |
|
No, my comment is +1 for current code on this PR. I'm saying we'll know what need to be "visible" while we work on the new features, and removing |
|
Here's a (tricky) approach that will retain the current amount of scoping, and get rid of the virtual calls: https://godbolt.org/z/G45cro7Pz |
How? Currently the contents of UDPPacketInternal are accessed through a cast . My suggestion is to make UDPacketInternal an object contained in UDPPacket. It would be accessed as a member. It shouldn't change any scoping and it would eliminate the awkward inheritance. |
|
Files that included UDPPacket.h (formerly I_UDPPacket.h) but not UDPPacketInternal.h (formally P_UDPPacket.h) could not access InternalData. |
|
Based on @maskit 's comment, should we leave this PR as is or add the internal class back or just close this for later? |
|
Brian and I don't agree on exactly what the issues are. You and Masakatsu think it's good as-is, so you win by a plurality. |
…ude friend declarations for class that need private access
* asf/master: (42 commits) Add logic to make the server.policy and server.properties settings reloadable (apache#9572) Add CMake to the required PR CI builds (apache#9575) fixup cmake build for master and add conditional for io_uring support (apache#9571) Cleanup: Use swoc::meta instead of ts::meta. (apache#9566) codeql 24: Multiplication result converted to larger type (apache#9569) Drop support for old quiche (apache#9561) QUIC: Ignore default_inactivity_timeout in favour of proxy.config.quic.no_activity_timeout_in. (apache#9564) Fix log format specifications (apache#9568) Add `current_time_epoch_ms` stat to be appended before the server version. This allows computation of stats externally based on the cache time frame. This can help alleviate issues with sliding windows between various stats programs that generate discrepencies (apache#9567) Define BIO macros in ink_ssl.h (apache#9557) combine UDPPacket and UDPPacketInternal (apache#9424) Update codeql.yml (apache#9560) Http2 to origin (apache#9366) coverity 1497413: Use of 32-bit time_t (apache#9556) Add support for multiple yaml config files for wasm plugin (apache#9483) Add TS_HAS_QUICHE feature variable. (apache#9547) mime header field parsing fix trailing quote handlling (apache#9513) Make magick plugin buildable with BoringSSL (apache#9554) QUIC: Test basic scenarios around the ts.quic.no_activity_timeout_in config. (apache#9543) Fix records events deps (apache#9511) ...
No description provided.