-
Notifications
You must be signed in to change notification settings - Fork 119
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 packet_len field to Packet Sent event #1605
Conversation
This commit adds a packet recorder which lets us check compare the recorded packet sent events against the packets sent on the network. We need to do a little extra bookkeeping to compare the network packets against the quic packets, but looks to work out fine in the end.
quic/s2n-quic/src/tests.rs
Outdated
_info: &ConnectionInfo, | ||
) -> Self::ConnectionContext { | ||
PacketSentContext { | ||
packet_sent: Arc::clone(&self.packet_sent), |
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.
packet_sent: Arc::clone(&self.packet_sent), | |
packet_sent: self.packet_sent, |
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.
The compiler doesn't like that one.
cannot move out of self.packet_sent
which is behind a mutable reference
move occurs because self.packet_sent
has type Arc<...Mutex<Vec<...PacketSent>>>
, which does not implement the Copy
trait.
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.
Is the thought that clone
is unnecessary and we should prefer to move, since the packet_sent
member of PacketSentSubscriber
doesn't get used again?
Some
/None
would be an option for that, but feels a bit heavy-handed.
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 dumb; I meant to add a .clone()
to the end. Yes the event types are all non-copy in case we want to add non-copyable fields in the future
- run & fix clippy on latest stable toolchain - run rustfmt on nightly toolchain - prettier equality checking that Cameron suggested - remove ugly clone since address implements it - call clone on variable, rather than Arc::clone(...)
Resolved issues:
#1444
Description of changes:
This PR adds a
packet_len
field to thePacketSent
event. It also adds a unit test to check that thepacket_len
is correct.Call-outs:
I don't particularly love the location of the unit test right now, but because it relies on the network simulator and the setup methods, it feels easiest to fit it in the
s2n-quic
crate.Testing:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.