Skip to content
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

Merged
merged 1 commit into from Aug 19, 2023

Conversation

marten-seemann
Copy link
Member

Fixes #3929.

Tests still missing.
Resolution to https://mailarchive.ietf.org/arch/msg/quic/oR4kxGKY6mjtPC1CZegY1ED4beg/ still missing.

@codecov
Copy link

codecov bot commented Jul 23, 2023

Codecov Report

Merging #3992 (89d3353) into master (501cc21) will decrease coverage by 0.02%.
Report is 2 commits behind head on master.
The diff coverage is 64.86%.

@@            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     
Files Changed Coverage Δ
internal/wire/header.go 81.41% <0.00%> (-0.83%) ⬇️
transport.go 67.45% <68.57%> (+0.15%) ⬆️

... and 3 files with indirect coverage changes

@@ -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
Copy link
Contributor

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).

Copy link
Member Author

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.

Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Member

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?

Copy link
Contributor

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).

Copy link
Member Author

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.

@marten-seemann
Copy link
Member Author

@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?

@bt90
Copy link
Contributor

bt90 commented Aug 14, 2023

@AudriusButkevicius

@AudriusButkevicius
Copy link
Contributor

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.

@calmh
Copy link

calmh commented Aug 16, 2023

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.

@marten-seemann marten-seemann changed the title make it possible to retrieve non-QUIC packets from the Transport add a method to retrieve non-QUIC packets from the Transport Aug 16, 2023
@marten-seemann marten-seemann force-pushed the non-quic-packets branch 3 times, most recently from 0c7898a to 557c4ac Compare August 18, 2023 10:06
@marten-seemann marten-seemann merged commit fe3c4f2 into master Aug 19, 2023
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make quic-go more STUN friendly
5 participants