FreeOverRoom ok
This commit is contained in:
parent
62ff2370ee
commit
52dfddbd82
@ -67,6 +67,7 @@ public:
|
||||
3: battleReport环境
|
||||
4: 打印性能日志
|
||||
5: 压力测试
|
||||
6: 删除over room
|
||||
*/
|
||||
std::set<int> flags;
|
||||
|
||||
|
@ -77,10 +77,22 @@ void Room::Init()
|
||||
void Room::UnInit()
|
||||
{
|
||||
xtimer_attacher.ClearTimerList();
|
||||
if (!stats_timer_) {
|
||||
if (stats_timer_) {
|
||||
a8::Timer::Instance()->DeleteTimer(stats_timer_);
|
||||
stats_timer_ = nullptr;
|
||||
}
|
||||
for (auto& pair : uniid_hash_) {
|
||||
delete pair.second;
|
||||
}
|
||||
uniid_hash_.clear();
|
||||
for (auto& pair : later_add_hash_) {
|
||||
delete pair.second;
|
||||
}
|
||||
later_add_hash_.clear();
|
||||
for (auto& pair : removed_robot_hash_) {
|
||||
delete pair.second;
|
||||
}
|
||||
removed_robot_hash_.clear();
|
||||
}
|
||||
|
||||
void Room::Update(int delta_time)
|
||||
|
@ -160,6 +160,13 @@ void RoomMgr::AddOverRoom(long long room_uuid)
|
||||
RoomMgr::Instance()->over_room_hash_[room->room_uuid] = room;
|
||||
}
|
||||
});
|
||||
a8::Timer::Instance()->AddDeadLineTimer(1000 + 100,
|
||||
a8::XParams()
|
||||
.SetSender(room_uuid),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
RoomMgr::Instance()->FreeOverRoom(param.sender);
|
||||
});
|
||||
}
|
||||
|
||||
void RoomMgr::ActiveRoom(long long room_uuid)
|
||||
@ -222,3 +229,15 @@ void RoomMgr::ReportServerState(int instance_id, const std::string& host, int po
|
||||
);
|
||||
delete url_params;
|
||||
}
|
||||
|
||||
void RoomMgr::FreeOverRoom(long long room_uuid)
|
||||
{
|
||||
if (App::Instance()->HasFlag(6)) {
|
||||
auto itr = over_room_hash_.find(room_uuid);
|
||||
if (itr != over_room_hash_.end()) {
|
||||
itr->second->UnInit();
|
||||
delete itr->second;
|
||||
over_room_hash_.erase(itr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
private:
|
||||
Room* GetJoinableRoom(const std::string& account_id);
|
||||
void ReportServerState(int instance_id, const std::string& host, int port);
|
||||
void FreeOverRoom(long long room_uuid);
|
||||
|
||||
private:
|
||||
std::map<long long, Room*> inactive_room_hash_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user