mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +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 {
|
pub struct Connection {
|
||||||
valid_until: ValidUntil,
|
valid_until: ValidUntil,
|
||||||
stage: ConnectionStage,
|
stage: ConnectionStage,
|
||||||
|
|
@ -534,9 +544,7 @@ pub fn run_handshakes_and_read_messages(
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let established = match connections.get(&poll_token).map(|c| &c.stage){
|
let established = match connections.get(&poll_token).map(|c| &c.stage){
|
||||||
Some(ConnectionStage::EstablishedWsTls(_)) => true,
|
Some(stage) => stage.is_established(),
|
||||||
Some(ConnectionStage::EstablishedWsNoTls(_)) => true,
|
|
||||||
Some(_) => false,
|
|
||||||
None => break,
|
None => break,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue