Skip to content

Commit

Permalink
Deactivation also goes to ConnectionMode::New
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Jan 7, 2025
1 parent 30db97e commit 1698442
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions upstairs/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,28 +575,27 @@ impl DownstairsClient {
// go through the live-repair path.
DsState::Stopping(ClientStopReason::NegotiationFailed(..)) => {
match up_state {
// If we haven't activated yet, then start from New
// If we haven't activated yet (or we're deactivating) then
// start from New
UpstairsState::GoActive(..)
| UpstairsState::Initializing => ConnectionMode::New,
| UpstairsState::Initializing
| UpstairsState::Deactivating { .. } => ConnectionMode::New,

// Otherwise, use live-repair
UpstairsState::Active
| UpstairsState::Deactivating { .. } => {
ConnectionMode::Faulted
}
UpstairsState::Active => ConnectionMode::Faulted,
}
}

DsState::Stopping(ClientStopReason::Replacing) => match up_state {
// If we haven't activated yet, then start from New
UpstairsState::GoActive(..) | UpstairsState::Initializing => {
ConnectionMode::New
}
// If we haven't activated yet (or we're deactivating), then
// start from New
UpstairsState::GoActive(..)
| UpstairsState::Initializing
| UpstairsState::Deactivating { .. } => ConnectionMode::New,

// Otherwise, use live-repair; `ConnectionMode::Replaced`
// indicates that the address is allowed to change.
UpstairsState::Active | UpstairsState::Deactivating { .. } => {
ConnectionMode::Replaced
}
UpstairsState::Active => ConnectionMode::Replaced,
},
};
let new_state = DsState::Connecting {
Expand Down

0 comments on commit 1698442

Please sign in to comment.