-
Notifications
You must be signed in to change notification settings - Fork 185
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
fix: make netsim run from examples #2959
fix: make netsim run from examples #2959
Conversation
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2959/docs/iroh/ Last updated: 2024-11-25T14:05:10Z |
|
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.
looks good overall
Waiting for CI and will merge. |
let duration = start.elapsed(); | ||
println!( | ||
"Received {} B in {:.4}s with ttfb {}s in {} chunks", | ||
HumanBytes(len as u64), |
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.
Did you mean to use HumanBytes
here? the B
in the format string suggests you just want an integer number of bytes that are easy to parse? The next line seems to do the human-friendly printing.
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.
Yes, mostly this is a precursor for moving the current netsim parsing to a different format. This just shows we have more data now.
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.
Did fix the extra B though.
duration.as_secs_f64(), | ||
HumanBytes((len as f64 / duration.as_secs_f64()) as u64) | ||
); | ||
|
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.
You now need to explicitly call endpoint.close().await
to make a best effort to let the other side know you closed the connection. If you don't do this and the datagram carrying the close was lost the other side will trigger a timeout. Awaiting the endpoint.close
makes sure to wait until the datagram carrying the close is acknowledged (or times out on the acknowledgement).
Currently you probably also want to put this endpoint.close().await
wrapped in a application-level timeout like you do on the other side because our API WRT timeouts is a bit crap right now...
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.
Something like now?
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.
Or should I move the endpoint.close also into the timeout?
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.
Something like this here:
tokio::time::timeout(Duration::from_secs(3), async move { | |
endpoint.close(0u8.into(), b"closing").await | |
})??; |
f4adb94
into
refactor-drop-external-protocols
## Description Moves our netsim tests to run from an example and only test the lib part of the code, not the full CLI & blobs. Things left to do: - [x] rename the example from `new` to anything that makes more sense `netsim` runs it under `iroh-transfer` - [x] clean up the example code - [x] add the option to provide either a relay config or pass in at least the relay url as an argument - [x] continue the CI adjustment and move all invocations of the netsim runner to run from `iroh_v2` and `integration_v2` sims (we want a less abrupt netsim switchover) - [x] convert the remaining sims in `chuck/netsim/sims` to the new format - [ ] after some time flip back the CI invocations to be regular `iroh` and `integration` sims which includes doing the same on `netsim` and removing the old ones ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented.
Description
Moves our netsim tests to run from an example and only test the lib part of the code, not the full CLI & blobs.
Things left to do:
new
to anything that makes more sensenetsim
runs it underiroh-transfer
iroh_v2
andintegration_v2
sims (we want a less abrupt netsim switchover)chuck/netsim/sims
to the new formatiroh
andintegration
sims which includes doing the same onnetsim
and removing the old onesBreaking Changes
Notes & open questions
Change checklist