-
Notifications
You must be signed in to change notification settings - Fork 170
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
feat(net-report)!: add net_report::Options
to specify which probes you want to run
#3032
base: main
Are you sure you want to change the base?
Conversation
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3032/docs/iroh/ Last updated: 2024-12-14T07:13:50Z |
I wonder if we should change this |
|
||
// The HTTP and ICMP probes only start after the STUN probes have had a chance. | ||
let mut https_probes = ProbeSet::new(ProbeProto::Https); | ||
let mut icmp_probes_ipv4 = ProbeSet::new(ProbeProto::IcmpV4); | ||
let mut icmp_probes_ipv6 = ProbeSet::new(ProbeProto::IcmpV6); | ||
|
||
let has_priority_probes = plan.has_priority_probes(); |
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.
little point in another variable is there?
let start = *max_stun_delay.get_or_insert_with(|| plan.max_delay()) | ||
+ DEFAULT_INITIAL_RETRANSMIT; | ||
let delay = start + DEFAULT_INITIAL_RETRANSMIT * attempt as u32; | ||
let delay = if !has_priority_probes { |
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 entirely sure why this needs changing. The old version uses let start = *max_stun_delay.get_or_insert_with(|| plan.max_delay())
. I would expect plan.max_delay()
to return 0 if there were no high-prio probes. So then start
should also be 0?
Admittedly I'm just reading code and didn't try this out.
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.
okay, I definitely changed this in the most confusing way, so refactored and added comments.
Basically, if there are no high priority probes, then we don't need start
to also add the DEFAULT_INITIAL_RETRANSMIT
, but if it DOES than we want to add that buffer.
Hopefully this is clearer. The issue was that if you don't have any high prio probes in the list of probes you are attempting, then all the probes added in this section started with a 100ms delay.
Yes, I agree this is worth trying out. I forgot what the reason for this is, but I think it might have just been for ease of testing, which you're changing here anyway by being able to not have stun probes when testing. And in the MagicSock we'll never need this functionality. |
I tried to create an alternative that would look like: But I wonder if we should then just remove it completely. Creating a socket is not that big of a hassle to justify essentially equivalent options to behave so differently/inconsistently among them, and make it consistent across protocols is also (comparatively) a lot more work. |
0919e95
to
079e917
Compare
079e917
to
194d4a0
Compare
net_report::Options
to specify which probes you want to runnet_report::Options
to specify which probes you want to run
63d3d29
to
0cc7e46
Compare
Okay here is what it looks like with removing the |
0cc7e46
to
4b2a970
Compare
4b2a970
to
5d991ff
Compare
Description
Breaking change that allows you to specify which probe protocols you would like to run.
Really written so it is easier to test QUIC address discovery on
iroh doctor
, but this also allows us to test specific protocols in isolation.Breaking Changes
iroh-net-report
net_report::Client::get_report_with_options
net_report::Client::get_report_channel
now takes anopts: net_report::Options
net_report::Client
will no longer bindUdpSocket
s when one is not provided for both STUN over IPv4 or STUN over IPv6.Notes & open questions
I'm open to adjustments on the
Options
. The whole "we build a UDP socket for you if one isn't provided" bit means that I couldn't rely on, for example,stun_sock_v4 == None
to know whether the user wanted to run a stun ipv4 probe, so I needed theprotocols: BTreeSet<ProbeProtocol>
field. I think this is a decent compromise between annoying and useful, but would love feedback.Edit:
Adjusted this so that the Options DO correlate to the protocols we want to run. This means that we will no longer bind a UdpSocket for you if one is not provided.
Change checklist