diff --git a/src/common/mainloop/client.rs b/src/common/mainloop/client.rs index 31c736c..c13acbf 100644 --- a/src/common/mainloop/client.rs +++ b/src/common/mainloop/client.rs @@ -149,7 +149,7 @@ where R: RecvServerPacket + std::fmt::Debug + Send + 'static, { async_std::task::spawn(async move { - server_sender.send(ClientAction::NewClient(client_id, client_sender)).await; + server_sender.send(ClientAction::NewClient(client_id, client_sender)).await.unwrap(); let mut pkt_receiver = PacketReceiver::new(socket, cipher); loop { @@ -157,14 +157,14 @@ where Ok(pkts) => { for pkt in pkts { trace!("[recv from {:?}] {:?}", client_id, pkt); - server_sender.send(ClientAction::Packet(client_id, pkt)).await; + server_sender.send(ClientAction::Packet(client_id, pkt)).await.unwrap(); } }, Err(err) => { match err { NetworkError::ClientDisconnected => { trace!("[client disconnected] {:?}", client_id); - server_sender.send(ClientAction::Disconnect(client_id)).await; + server_sender.send(ClientAction::Disconnect(client_id)).await.unwrap(); break; } _ => { @@ -229,10 +229,10 @@ fn state_client_loop(state: Arc>, for action in actions { match action { OnConnect::Cipher((inc, outc)) => { - sender.send(ServerStateAction::Cipher(inc, outc)).await; + sender.send(ServerStateAction::Cipher(inc, outc)).await.unwrap(); }, OnConnect::Packet(pkt) => { - sender.send(ServerStateAction::Packet(pkt)).await; + sender.send(ServerStateAction::Packet(pkt)).await.unwrap(); } } } @@ -249,7 +249,7 @@ fn state_client_loop(state: Arc>, Ok(pkts) => { for (client_id, pkt) in pkts { if let Some(client) = clients.get_mut(&client_id) { - client.send(ServerStateAction::Packet(pkt)).await; + client.send(ServerStateAction::Packet(pkt)).await.unwrap(); } } }, @@ -264,12 +264,12 @@ fn state_client_loop(state: Arc>, Ok(pkts) => { for (client_id, pkt) in pkts { if let Some(client) = clients.get_mut(&client_id) { - client.send(ServerStateAction::Packet(pkt)).await; + client.send(ServerStateAction::Packet(pkt)).await.unwrap(); } } if let Some(client) = clients.get_mut(&client_id) { - client.send(ServerStateAction::Disconnect).await; + client.send(ServerStateAction::Disconnect).await.unwrap(); } } Err(err) => { diff --git a/src/common/mainloop/interserver.rs b/src/common/mainloop/interserver.rs index 526e51d..473abb4 100644 --- a/src/common/mainloop/interserver.rs +++ b/src/common/mainloop/interserver.rs @@ -79,7 +79,7 @@ where ships.insert(server_id, ship_action_sender); for (server, action) in state.on_connect(server_id).await { if let Some(sender) = ships.get_mut(&server) { - sender.send(action).await; + sender.send(action).await.unwrap(); } } }, @@ -89,7 +89,7 @@ where Ok(actions) => { for (server, action) in actions{ if let Some(sender) = ships.get_mut(&server) { - sender.send(action).await; + sender.send(action).await.unwrap(); } } }, @@ -103,7 +103,7 @@ where ships.remove(&server_id); for (server, action) in actions { if let Some(sender) = ships.get_mut(&server) { - sender.send(action).await; + sender.send(action).await.unwrap(); } } } @@ -121,7 +121,7 @@ where R: DeserializeOwned + std::fmt::Debug + Send + 'static, { async_std::task::spawn(async move { - state_loop_sender.send(InterserverInputAction::NewConnection(server_id, output_loop_sender)).await; + state_loop_sender.send(InterserverInputAction::NewConnection(server_id, output_loop_sender)).await.unwrap(); let mut msg_receiver = MessageReceiver::new(socket); loop { @@ -129,12 +129,12 @@ where match msg_receiver.recv().await { Ok(msg) => { info!("[login recv loop msg] {:?}", msg); - state_loop_sender.send(InterserverInputAction::Message(server_id, msg)).await; + state_loop_sender.send(InterserverInputAction::Message(server_id, msg)).await.unwrap(); }, Err(err) => { if let MessageReceiverError::Disconnected = err { info!("[login recv loop disconnect] {:?}", server_id); - state_loop_sender.send(InterserverInputAction::Disconnect(server_id)).await; + state_loop_sender.send(InterserverInputAction::Disconnect(server_id)).await.unwrap(); break; } info!("[login recv loop err] {:?}", err); @@ -200,7 +200,7 @@ pub fn login_listen_mainloop(state: Arc(state: Arc ServerState for LoginServerState { if let Some(username) = self.clients.remove(&id) { if let Ok(mut user) = self.entity_gateway.get_user_by_name(username).await { user.at_login = false; - self.entity_gateway.save_user(&user).await; + self.entity_gateway.save_user(&user).await?; } } Ok(Vec::new())