refactor(client): separate accepted negotiation state from peer evidence

This commit is contained in:
Nils Andreas Svee committed 2026-10-04 18:19:28 +07:00
1 parent f62e6a9953
commit d467211f41
32 files changed
+507 -447

No files matched your search

@@ -10,7 +10,7 @@
use std::time::Duration;
use irtt_client::{
AsyncClient, ClientConfig, NegotiationPolicy, NegotiationRestriction, OpenOutcome, OpenPolicy,
AsyncClient, ClientConfig, NegotiationChange, NegotiationPolicy, OpenOutcome, OpenPolicy,
SessionRequest,
};
use irtt_proto::{
@@ -166,21 +166,23 @@ async fn exercise_fallback_negotiation() {
.await
.unwrap();
match loose.open().await.unwrap() {
OpenOutcome::Started { negotiated, .. } => {
OpenOutcome::Started(irtt_client::SessionStarted {
negotiation: negotiated,
..
}) => {
assert_eq!(
negotiated
.params
.server_fill
.map(|fill| fill.value)
.as_deref(),
negotiated.accepted.server_fill.as_deref(),
Some("pattern:69727474"),
"the server reports the default descriptor it fell back to"
);
assert!(negotiated
.restrictions
.contains(&NegotiationRestriction::ServerFillChanged));
.changes
.contains(&NegotiationChange::ServerFillChanged {
requested: Some("bogus".to_owned()),
negotiated: Some("pattern:69727474".to_owned())
}));
}
OpenOutcome::NoTestCompleted { .. } => panic!("normal client unexpectedly ran no-test"),
OpenOutcome::NoTestCompleted(_) => panic!("normal client unexpectedly ran no-test"),
}
loose.close().await.unwrap();