添加房间已满逻辑判断
This commit is contained in:
parent
2112d6aa7c
commit
e728ab7442
@ -12,6 +12,8 @@
|
|||||||
#include "jsondatamgr.h"
|
#include "jsondatamgr.h"
|
||||||
#include "cs_proto.pb.h"
|
#include "cs_proto.pb.h"
|
||||||
#include "cs_msgid.pb.h"
|
#include "cs_msgid.pb.h"
|
||||||
|
#include "ss_proto.pb.h"
|
||||||
|
#include "ss_msgid.pb.h"
|
||||||
#include "handlermgr.h"
|
#include "handlermgr.h"
|
||||||
|
|
||||||
class GCClientSession: public a8::MixedSession
|
class GCClientSession: public a8::MixedSession
|
||||||
@ -137,6 +139,12 @@ void GGListener::ForceCloseClient(int sockhandle)
|
|||||||
tcp_listener_->ForceCloseClient(sockhandle);
|
tcp_listener_->ForceCloseClient(sockhandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GGListener::ForceCloseChildSocket(int sockhandle)
|
||||||
|
{
|
||||||
|
ss::SS_ForceCloseSocket msg;
|
||||||
|
SendProxyMsg(sockhandle, msg);
|
||||||
|
}
|
||||||
|
|
||||||
void GGListener::MarkClient(int sockhandle, bool is_active)
|
void GGListener::MarkClient(int sockhandle, bool is_active)
|
||||||
{
|
{
|
||||||
tcp_listener_->MarkClient(sockhandle, is_active);
|
tcp_listener_->MarkClient(sockhandle, is_active);
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
const char* file = nullptr, int lineno = 0, int error_param = 0);
|
const char* file = nullptr, int lineno = 0, int error_param = 0);
|
||||||
|
|
||||||
void ForceCloseClient(int sockhandle);
|
void ForceCloseClient(int sockhandle);
|
||||||
|
void ForceCloseChildSocket(int sockhandle);
|
||||||
void MarkClient(int sockhandle, bool is_active);
|
void MarkClient(int sockhandle, bool is_active);
|
||||||
long long GetSendNodeNum();
|
long long GetSendNodeNum();
|
||||||
long long GetSentNodeNum();
|
long long GetSentNodeNum();
|
||||||
|
@ -51,7 +51,30 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
if (RoomNum() >= ROOM_NUM_LIMIT) {
|
if (RoomNum() >= ROOM_NUM_LIMIT) {
|
||||||
return;
|
{
|
||||||
|
cs::SMJoinedNotify notifymsg;
|
||||||
|
notifymsg.set_error_code(2);
|
||||||
|
GGListener::Instance()->SendToClient(hdr.socket_handle, hdr.seqid, notifymsg);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
a8::Timer::Instance()->AddDeadLineTimer(1000 * 2,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(hdr.socket_handle),
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
GGListener::Instance()->ForceCloseChildSocket(param.sender);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
a8::UdpLog::Instance()->Warning("room is full! accountid:%s max_mainloop_rundelay:%d "
|
||||||
|
"room_num:%d player_num:%d online_num:%d",
|
||||||
|
{
|
||||||
|
msg.account_id(),
|
||||||
|
App::Instance()->perf.max_run_delay_time,
|
||||||
|
RoomMgr::Instance()->RoomNum(),
|
||||||
|
App::Instance()->perf.entity_num[ET_Player],
|
||||||
|
PlayerMgr::Instance()->OnlineNum(),
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
Room* room = GetJoinableRoom(msg.account_id());
|
Room* room = GetJoinableRoom(msg.account_id());
|
||||||
if (!room) {
|
if (!room) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user