Skip to content

Commit

Permalink
Replace loop-brake with while
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Apr 22, 2023
1 parent daf37b2 commit d354fc4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
7 changes: 2 additions & 5 deletions src/asynch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ where
Handshake::new(Verifier::new(context.config.server_name));
let mut state = State::ClientHello;

loop {
while state != State::ApplicationData {
let next_state = state
.process(
&mut self.delegate,
Expand All @@ -100,11 +100,8 @@ where
.await?;
trace!("State {:?} -> {:?}", state, next_state);
state = next_state;
if let State::ApplicationData = state {
self.opened = true;
break;
}
}
self.opened = true;

Ok(())
}
Expand Down
7 changes: 2 additions & 5 deletions src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ where
Handshake::new(Verifier::new(context.config.server_name));
let mut state = State::ClientHello;

loop {
while state != State::ApplicationData {
let next_state = state.process_blocking(
&mut self.delegate,
&mut handshake,
Expand All @@ -98,11 +98,8 @@ where
)?;
trace!("State {:?} -> {:?}", state, next_state);
state = next_state;
if let State::ApplicationData = state {
self.opened = true;
break;
}
}
self.opened = true;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ where
}
}

#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum State {
ClientHello,
Expand Down

0 comments on commit d354fc4

Please sign in to comment.