Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
tkzcfc committed Jul 23, 2024
1 parent fcea957 commit 2ac7840
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion np_server/src/peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ impl SessionDelegate for Peer {
self.tx.take();
// 清退对应玩家
if let Some(player) = self.player.take() {
player.write().await.on_disconnect_session().await;
if player.read().await.get_player_id() == self.session_id {
player.write().await.on_disconnect_session().await;
}
}
Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions np_server/src/player/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ impl Player {
// 玩家被顶号,需要对旧的会话发送一些消息
pub async fn on_terminate_old_session(&mut self) {
//
self.close_session();

// 重置会话信息
self.reset_session_info();
Expand Down

0 comments on commit 2ac7840

Please sign in to comment.