mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 02:35:31 +00:00
aquatic_ws: move more code into Connection impl
This commit is contained in:
parent
7011a797ee
commit
63b84e7706
2 changed files with 33 additions and 27 deletions
|
|
@ -116,10 +116,7 @@ fn accept_new_streams(
|
|||
.register(&mut stream, token, Interest::READABLE)
|
||||
.unwrap();
|
||||
|
||||
let connection = Connection::new(
|
||||
valid_until,
|
||||
Either::Right(HandshakeMachine::new(stream))
|
||||
);
|
||||
let connection = Connection::new(valid_until, stream);
|
||||
|
||||
connections.insert(token, connection);
|
||||
},
|
||||
|
|
@ -178,15 +175,13 @@ pub fn run_handshakes_and_read_messages(
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else if let Some(machine) = connections.remove(&poll_token)
|
||||
.and_then(Connection::get_machine)
|
||||
{
|
||||
let (result, stop_loop) = machine
|
||||
.advance(opt_tls_acceptor);
|
||||
|
||||
if let Some(inner) = result {
|
||||
let connection = Connection::new(valid_until, inner);
|
||||
} else if let Some(connection) = connections.remove(&poll_token){
|
||||
let (opt_new_connection, stop_loop) = connection.advance_handshakes(
|
||||
opt_tls_acceptor,
|
||||
valid_until
|
||||
);
|
||||
|
||||
if let Some(connection) = opt_new_connection {
|
||||
connections.insert(poll_token, connection);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue