Skip to content

Commit d7003ab

Browse files
sarroutbiansasaki
authored andcommitted
Retry registration forever in the state machine
Signed-off-by: Sergio Arroutbi <[email protected]>
1 parent 46b1901 commit d7003ab

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

keylime-push-model-agent/src/state_machine.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub enum State {
1818
Negotiating(ContextInfo),
1919
Attesting(ContextInfo, ResponseInformation),
2020
Complete,
21+
RegistrationFailed(anyhow::Error),
2122
Failed(anyhow::Error),
2223
}
2324

@@ -74,6 +75,11 @@ impl<'a> StateMachine<'a> {
7475
self.state = State::Complete;
7576
break;
7677
}
78+
State::RegistrationFailed(e) => {
79+
error!("Registration failed: {e:?}");
80+
debug!("Resetting state to Unregistered and retrying");
81+
self.state = State::Unregistered;
82+
}
7783
State::Failed(e) => {
7884
error!("Attestation failed: {e:?}");
7985
self.state = State::Failed(e);
@@ -100,8 +106,9 @@ impl<'a> StateMachine<'a> {
100106
}
101107
}
102108
Err(e) => {
103-
self.state =
104-
State::Failed(anyhow!("Registration failed: {e:?}"));
109+
self.state = State::RegistrationFailed(anyhow!(
110+
"Registration failed: {e:?}"
111+
));
105112
}
106113
}
107114
}

0 commit comments

Comments
 (0)