-
Notifications
You must be signed in to change notification settings - Fork 15
serviceability: tell an IP conflict apart from an already-subscribed user #4159
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -216,6 +216,12 @@ pub enum DoubleZeroError { | |
| UserFeedLimitExceeded, // variant 103 | ||
| #[error("An EdgeSeat feed seat is only held by a Multicast user")] | ||
| EdgeSeatIsMulticastOnly, // variant 104 | ||
| #[error( | ||
| "A user already exists at this client IP with a different device, owner, type or tenant" | ||
| )] | ||
| UserExistsWithDifferentAttributes, // variant 105 | ||
| #[error("This user is already subscribed to the requested multicast group")] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error tells the caller they are already subscribed to the group they asked for, but the code never checks group membership — it fires whenever any matching user account exists, so a user subscribed to nothing, or to a different group, is told they are already subscribed. #[error("A user already exists at this client IP; change group roles with UpdateMulticastGroupRoles or SubscribeFeed")]
UserAlreadyExists, // variant 106Worth a test hitting |
||
| SubscribeUserAlreadyExists, // variant 106 | ||
| } | ||
|
|
||
| impl From<DoubleZeroError> for ProgramError { | ||
|
|
@@ -326,6 +332,8 @@ impl From<DoubleZeroError> for ProgramError { | |
| DoubleZeroError::UserDeviceMismatch => ProgramError::Custom(102), | ||
| DoubleZeroError::UserFeedLimitExceeded => ProgramError::Custom(103), | ||
| DoubleZeroError::EdgeSeatIsMulticastOnly => ProgramError::Custom(104), | ||
| DoubleZeroError::UserExistsWithDifferentAttributes => ProgramError::Custom(105), | ||
| DoubleZeroError::SubscribeUserAlreadyExists => ProgramError::Custom(106), | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -437,6 +445,8 @@ impl From<u32> for DoubleZeroError { | |
| 102 => DoubleZeroError::UserDeviceMismatch, | ||
| 103 => DoubleZeroError::UserFeedLimitExceeded, | ||
| 104 => DoubleZeroError::EdgeSeatIsMulticastOnly, | ||
| 105 => DoubleZeroError::UserExistsWithDifferentAttributes, | ||
| 106 => DoubleZeroError::SubscribeUserAlreadyExists, | ||
| _ => DoubleZeroError::Custom(e), | ||
| } | ||
| } | ||
|
|
||
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 comment describes a fallback that cannot happen: a zero
dz_prefix_countdoes not create a Pending user, it makes the whole instruction fail. The program rejectsdz_prefix_count == 0up front at create_subscribe.rs:71, and the count comes fromdevice.dz_prefixes.len()(dz_ledger_reader.rs:313), so a device with no prefixes hits that hard failure rather than a duplicate on the next cycle.