Skip to content

Commit

Permalink
Ignore LeaveReq before game start.
Browse files Browse the repository at this point in the history
  • Loading branch information
fluxxu committed Nov 5, 2024
1 parent 6f3d393 commit 9c04608
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
8 changes: 2 additions & 6 deletions crates/client/src/lan/game/lobby.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,8 @@ impl<'a> LobbyHandler<'a> {
let pkt = next?;
if let Some(pkt) = pkt {
if pkt.type_id() == LeaveReq::PACKET_TYPE_ID {
if let Some(node_stream) = self.node_stream.as_mut() {
node_stream.report_slot_status(SlotClientStatus::Connected).await.ok();
}
self.stream.send(Packet::simple(LeaveAck)?).await?;
self.stream.flush().await?;
return Ok(LobbyAction::Leave)
tracing::warn!("received leave request during lobby, ignoring");
continue;
}

self.handle_packet(&mut join_state, base_t, pkt).await?;
Expand Down
7 changes: 2 additions & 5 deletions crates/client/src/lan/game/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,8 @@ impl State {
node_stream.report_slot_status(SlotClientStatus::Loaded).await?;
},
LeaveReq::PACKET_TYPE_ID => {
tracing::debug!("leave: {:?}", my_slot_player_id);
node_stream.report_slot_status(SlotClientStatus::Connected).await.ok();
stream.send(Packet::simple(LeaveAck)?).await?;
stream.flush().await?;
break;
tracing::warn!("received leave request during loading, ignoring");
continue;
}
PongToHost::PACKET_TYPE_ID => {}
_ => {
Expand Down

0 comments on commit 9c04608

Please sign in to comment.