This commit is contained in:
aozhiwei 2019-08-31 18:46:27 +08:00
parent 31c67f0f28
commit 8dd18e5aa0
3 changed files with 12 additions and 2 deletions

View File

@ -16,7 +16,9 @@
#include "framework/cpp/httpclientpool.h"
const int ROOM_NUM_LIMIT = 20;
const int ROOM_NUM_DOWN_LIMIT = 20;
const int ROOM_NUM_UP_LIMIT = 40;
const int HUM_NUM_DOWN_LIMIT = 500;
void RoomMgr::Init()
{
@ -50,7 +52,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
if (!hum_meta) {
abort();
}
if (RoomNum() >= ROOM_NUM_LIMIT) {
if (IsLimitJoin()) {
{
cs::SMJoinedNotify notifymsg;
notifymsg.set_error_code(2);
@ -272,3 +274,9 @@ void RoomMgr::InstallReportStateTimer()
&reportstate_timer_attacher_.timer_list_);
}
}
bool RoomMgr::IsLimitJoin()
{
return RoomNum() >= ROOM_NUM_UP_LIMIT ||
(RoomNum() >= ROOM_NUM_DOWN_LIMIT && App::Instance()->perf.alive_count >= HUM_NUM_DOWN_LIMIT);
}

View File

@ -34,6 +34,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
Room* GetJoinableRoom(const std::string& account_id);
void ReportServerState(int instance_id, const std::string& host, int port);
void FreeOverRoom(long long room_uuid);
bool IsLimitJoin();
private:
std::map<long long, Room*> inactive_room_hash_;

View File

@ -222,4 +222,5 @@ void GSMgr::ClearTimeOutNode()
}
node_key_hash_.erase(node->key);
}
RearrangeNode();
}