数据统计ok
This commit is contained in:
parent
8668493053
commit
7a9332375b
@ -59,7 +59,7 @@ static void SavePerfLog()
|
||||
RoomMgr::Instance()->RoomNum()
|
||||
});
|
||||
if (App::Instance()->HasFlag(4)) {
|
||||
a8::XPrintf("max_mainloop_rundelay:%d max_dispatchmsg_time:%d room_num:%d online_num:%d\n",
|
||||
a8::XPrintf("mainloop_time:%d netmsg_time:%d room:%d online:%d\n",
|
||||
{
|
||||
App::Instance()->perf.max_run_delay_time,
|
||||
App::Instance()->perf.max_dispatchmsg_time,
|
||||
|
@ -1147,6 +1147,7 @@ void Room::OnGameOver()
|
||||
pair.second->SendGameOver();
|
||||
}
|
||||
}
|
||||
RoomMgr::Instance()->AddOverRoom(room_uuid);
|
||||
}
|
||||
|
||||
void Room::RandRemoveAndroid()
|
||||
|
@ -131,11 +131,6 @@ int RoomMgr::RoomNum()
|
||||
return room_hash_.size();
|
||||
}
|
||||
|
||||
int RoomMgr::ActiveRoomNum()
|
||||
{
|
||||
return room_hash_.size() - over_room_hash_.size();
|
||||
}
|
||||
|
||||
Room* RoomMgr::GetJoinableRoom(const std::string& account_id)
|
||||
{
|
||||
for (auto& pair : inactive_room_hash_) {
|
||||
@ -146,12 +141,27 @@ Room* RoomMgr::GetJoinableRoom(const std::string& account_id)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Room* RoomMgr::GetRoomByUuid(long long uuid)
|
||||
Room* RoomMgr::GetRoomByUuid(long long room_uuid)
|
||||
{
|
||||
auto itr = room_hash_.find(uuid);
|
||||
auto itr = room_hash_.find(room_uuid);
|
||||
return itr != room_hash_.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
||||
void RoomMgr::AddOverRoom(long long room_uuid)
|
||||
{
|
||||
a8::Timer::Instance()->AddDeadLineTimer(1000,
|
||||
a8::XParams()
|
||||
.SetSender(room_uuid),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Room* room = RoomMgr::Instance()->GetRoomByUuid(param.sender);
|
||||
if (room) {
|
||||
RoomMgr::Instance()->room_hash_.erase(room->room_uuid);
|
||||
RoomMgr::Instance()->over_room_hash_[room->room_uuid] = room;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void RoomMgr::RemoveFromInactiveRoomHash(long long room_uuid)
|
||||
{
|
||||
inactive_room_hash_.erase(room_uuid);
|
||||
@ -169,7 +179,7 @@ void RoomMgr::ReportServerState(int instance_id, const std::string& host, int po
|
||||
url_params->SetVal("ip", JsonDataMgr::Instance()->ip);
|
||||
url_params->SetVal("port", JsonDataMgr::Instance()->listen_port);
|
||||
url_params->SetVal("online_num", PlayerMgr::Instance()->OnlineNum());
|
||||
url_params->SetVal("room_num", ActiveRoomNum());
|
||||
url_params->SetVal("room_num", RoomNum());
|
||||
f8::HttpClientPool::Instance()->HttpGet(a8::XParams()
|
||||
.SetSender(instance_id)
|
||||
.SetParam1(host)
|
||||
|
@ -23,8 +23,8 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
||||
void RemoveFromInactiveRoomHash(long long room_uuid);
|
||||
int RoomNum();
|
||||
int ActiveRoomNum();
|
||||
Room* GetRoomByUuid(long long uuid);
|
||||
void AddOverRoom(long long room_uuid);
|
||||
|
||||
private:
|
||||
Room* GetJoinableRoom(const std::string& account_id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user