|
@ -224,7 +224,7 @@ async fn state_client_loop<STATE, S, R, E>(state: Arc<Mutex<STATE>>, |
|
|
match action {
|
|
|
match action {
|
|
|
ClientAction::NewClient(client_id, sender) => {
|
|
|
ClientAction::NewClient(client_id, sender) => {
|
|
|
clients.insert(client_id, sender.clone());
|
|
|
clients.insert(client_id, sender.clone());
|
|
|
for action in state.on_connect(client_id) {
|
|
|
|
|
|
|
|
|
for action in state.on_connect(client_id).await {
|
|
|
match action {
|
|
|
match action {
|
|
|
OnConnect::Cipher((inc, outc)) => {
|
|
|
OnConnect::Cipher((inc, outc)) => {
|
|
|
sender.send(ServerStateAction::Cipher(inc, outc)).await;
|
|
|
sender.send(ServerStateAction::Cipher(inc, outc)).await;
|
|
@ -251,7 +251,7 @@ async fn state_client_loop<STATE, S, R, E>(state: Arc<Mutex<STATE>>, |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
ClientAction::Disconnect(client_id) => {
|
|
|
ClientAction::Disconnect(client_id) => {
|
|
|
let pkts = state.on_disconnect(client_id);
|
|
|
|
|
|
|
|
|
let pkts = state.on_disconnect(client_id).await;
|
|
|
for (client_id, pkt) in pkts {
|
|
|
for (client_id, pkt) in pkts {
|
|
|
if let Some(client) = clients.get_mut(&client_id) {
|
|
|
if let Some(client) = clients.get_mut(&client_id) {
|
|
|
client.send(ServerStateAction::Packet(pkt)).await;
|
|
|
client.send(ServerStateAction::Packet(pkt)).await;
|
|
|