Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions noq-proto/src/connection/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@ pub enum PathStatus {

/// Application events about paths
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need non-exhaustive on the event fields as well. I think e.g. iroh would benefit from adding the remote address to Established and that would be nice to be able to do without breaking the API

pub enum PathEvent {
/// A new path has established connection with the peer.
Established {
Expand Down
9 changes: 9 additions & 0 deletions noq/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,15 @@ impl State {
NatTraversal(update) => {
self.nat_traversal_updates.send(update).ok();
}
_ => {
// PathEvent is #[non_exhaustive].
// It's possible that noq is built against a newer noq-proto version.
// In that case, we need to ignore path events we can't handle yet.
// But for tests, we expect noq and noq-proto to be in sync, so we
// should panic in case we don't actually handle new cases.
#[cfg(test)]
panic!("Unhandled PathEvent variant: {event:?}");
}
}
}
}
Expand Down
Loading