mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
WIP: aquatic_ws: network: add ConnectionStage::is_established
This commit is contained in:
parent
6e0b0ccbc2
commit
800d3b0efa
1 changed files with 11 additions and 3 deletions
|
|
@ -38,6 +38,16 @@ pub enum ConnectionStage {
|
|||
}
|
||||
|
||||
|
||||
impl ConnectionStage {
|
||||
pub fn is_established(&self) -> bool {
|
||||
match self {
|
||||
Self::EstablishedWsTls(_) | Self::EstablishedWsNoTls(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub struct Connection {
|
||||
valid_until: ValidUntil,
|
||||
stage: ConnectionStage,
|
||||
|
|
@ -534,9 +544,7 @@ pub fn run_handshakes_and_read_messages(
|
|||
|
||||
loop {
|
||||
let established = match connections.get(&poll_token).map(|c| &c.stage){
|
||||
Some(ConnectionStage::EstablishedWsTls(_)) => true,
|
||||
Some(ConnectionStage::EstablishedWsNoTls(_)) => true,
|
||||
Some(_) => false,
|
||||
Some(stage) => stage.is_established(),
|
||||
None => break,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue