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
add a method to retrieve non-QUIC packets from the Transport #3992
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3992 +/- ##
==========================================
- Coverage 83.28% 83.26% -0.02%
==========================================
Files 147 147
Lines 14806 14880 +74
==========================================
+ Hits 12330 12389 +59
- Misses 1978 1991 +13
- Partials 498 500 +2
|
@@ -85,6 +85,9 @@ type Transport struct { | |||
createdConn bool | |||
isSingleUse bool // was created for a single server or client, i.e. by calling quic.Listen or quic.Dial | |||
|
|||
readingNonQUICPackets atomic.Bool |
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.
Don't see the point of this bool. Why wouldn't we always have the buffer allocated (based on size param somewhere) and just drop on overflow (or when sized to zero).
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.
Filled with packet, this would add 32*1500 = ~48 kB of wasted memory. I'd like to avoid that.
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.
Not if the count is configurable and set to 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.
I was trying to avoid introducing yet more configuration API.
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.
It's only configurable if you need it. It's zero by default, so doesn't seem like you need to provide a value?
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.
Not if it's initializes at point the transport is constructed? The channel can be nil by default at which point we'd just drop the packets?
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'd still argue that this is not needed and could be done on nil'ness of the channel.
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.
Variable assignment isn’t atomic in Go (iirc), so checking nil-ness and assigning from a different routine is technically undefined. You’d need to synchronize it with a mutex in that case. That’d work, but probably the explicit bool is a bit more readable?
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 would still expose the responsibility of the channel creation/assignment to the builder of the transport type (before its used). Then you can use a nil check, and a user can control the buffer size (which is now quite small).
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'm not convinced that's the best choice for the API here. I think I'm going to merge the PR as is, and we'll see how it works in practice. We can still change it later if we have a better idea.
990230d
to
f38cabb
Compare
76d2db8
to
6f12cce
Compare
@bt90 I see you're blocked on this PR in syncthing. Have you tried out this branch yet? Does it work for your use case and allow you to retire the filter implementation? |
I don't think we are blocked. We just can't pick up the latest optimizations as we rely on this type of functionality which we are currently implementing with a separate package. |
Maybe not blocked-blocked, but given that migrating to the new transport stuff is a refactor that doesn't fit cleanly into our existing way of doing it (since we can't write to the socket directly any more, nor read from the new transport), this would be welcome so that we don't need to rearchitect twice for the same change. |
0c7898a
to
557c4ac
Compare
557c4ac
to
89d3353
Compare
Fixes #3929.
Tests still missing.
Resolution to https://mailarchive.ietf.org/arch/msg/quic/oR4kxGKY6mjtPC1CZegY1ED4beg/ still missing.