Skip to content

Commit

Permalink
fixes: #514
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgazelka committed Oct 31, 2024
1 parent a7b7a53 commit 15eae35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 10 additions & 3 deletions crates/hyperion-proxy/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ pub fn initiate_player_connection(
)
.unwrap();

server_sender.send(connect).await.unwrap();
if let Err(e) = server_sender.send(connect).await {
warn!("failed to send player connect to server: {e}");
return;
}

let mut arena = Arena::new();

Expand Down Expand Up @@ -158,7 +161,9 @@ pub fn initiate_player_connection(
}),
).unwrap();

server_sender.send(disconnect).await.unwrap();
if let Err(e) = server_sender.send(disconnect).await {
warn!("failed to send player disconnect to server: {e}");
}
},
_ = &mut packet_reader_task => {
info!("Player disconnected because reader task finished: {player_id:?}");
Expand All @@ -171,7 +176,9 @@ pub fn initiate_player_connection(
reason: PlayerDisconnectReason::LostConnection,
})).unwrap();

server_sender.send(disconnect).await.unwrap();
if let Err(e) = server_sender.send(disconnect).await {
warn!("failed to send player disconnect to server: {e}");
}

let map_ref = player_registry.pin();
map_ref.remove(&player_id);
Expand Down
7 changes: 5 additions & 2 deletions crates/hyperion-proxy/src/server_sender.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::io::IoSlice;

use rkyv::util::AlignedVec;
use tracing::{trace_span, Instrument};
use tracing::{trace_span, warn, Instrument};

use crate::util::AsyncWriteVectoredExt;

Expand Down Expand Up @@ -48,7 +48,10 @@ pub fn launch_server_writer(mut write: tokio::net::tcp::OwnedWriteHalf) -> Serve
io_slices.push(msg);
}

write.write_vectored_all(&mut io_slices).await.unwrap();
if let Err(e) = write.write_vectored_all(&mut io_slices).await {
warn!("failed to write to server: {e}");
return;
}

lengths.clear();
messages.clear();
Expand Down

0 comments on commit 15eae35

Please sign in to comment.