This commit is contained in:
aozhiwei 2024-05-17 15:49:31 +08:00
parent c759742f5f
commit c338a4e24a
2 changed files with 27 additions and 2 deletions

View File

@ -2026,9 +2026,10 @@ void Human::NotifyObservers(cs::SMUpdate* msg, cs::MFActivePlayerData* active_pl
}
if (a8::XGetTickCount() - itr->second > 1000 * 10) {
itr->second = a8::XGetTickCount();
a8::XPrintf("LastSendUpdate account_id:%s socket_handle:%d\n",
a8::XPrintf("LastSendUpdate account_id:%s room_uuid:%s socket_handle:%d\n",
{
observer->AsPlayer()->account_id,
room->GetRoomUuid(),
observer->socket_handle
});
}
@ -2267,6 +2268,7 @@ void Human::ReJoin(long ip_saddr, int socket_handle)
if (!IsPlayer()) {
abort();
}
auto old_socket_handle = this->socket_handle;
this->ip_saddr = ip_saddr;
this->socket_handle = socket_handle;
room->frame_event.AddEnterGame(GetWeakPtrRef());
@ -2278,6 +2280,15 @@ void Human::ReJoin(long ip_saddr, int socket_handle)
RefreshView();
room->NotifyUiUpdate();
PlayerMgr::Instance()->ReBindSocket(AsPlayer());
#ifdef MYDEBUG
a8::XPrintf("ReJoin account_id:%s old_socket_handle:%d new_socket_handle:%d socket_handle:%d\n",
{
account_id,
old_socket_handle,
this->socket_handle,
socket_handle
});
#endif
if (room->IsMobaModeRoom()) {
room->xtimer.SetIntervalEx
(SERVER_FRAME_RATE,
@ -2418,6 +2429,13 @@ Player* PlayerMgr::CreatePlayerByCustomMember(Player* hum,
int socket,
std::shared_ptr<CustomMember> member)
{
#ifdef MYDEBUG
a8::XPrintf("CreatePlayerByCustomMember account_id:%s socket_handle:%d\n",
{
hum->account_id,
socket,
});
#endif
hum->socket_handle = socket;
hum->ip_saddr = ip_saddr;
hum->account_id = member->GetAccountId();

View File

@ -53,7 +53,7 @@ void PlayerMgr::OnClientDisconnect(int socket_handle)
RemovePlayerBySocket(socket_handle);
hum->room->OnPlayerOffline(hum);
#if MYDEBUG
a8::XPrintf("remove socket1 %d\n", {socket_handle});
a8::XPrintf("remove socket1 account_id%s %d\n", {hum->account_id, socket_handle});
#endif
}
}
@ -118,5 +118,12 @@ void PlayerMgr::DecAccountNum(const std::string& account_id)
void PlayerMgr::ReBindSocket(Player* hum)
{
#ifdef MYDEBUG
a8::XPrintf("ReBindSocket account_id:%s socket_handle:%d\n",
{
hum->account_id,
hum->socket_handle
});
#endif
socket_hash_[hum->socket_handle] = hum;
}