Compare commits

...

7 Commits
ty ... master

Author SHA1 Message Date
aozhiwei
f37aed628b 1 2024-08-24 07:43:18 +08:00
aozhiwei
e301be3dc1 1 2024-07-27 15:29:36 +08:00
aozhiwei
0e2ac2bb59 1 2024-06-01 18:26:10 +08:00
aozhiwei
7c3edc1074 1 2024-06-01 17:56:50 +08:00
aozhiwei
3e424d81aa 1 2024-06-01 17:45:01 +08:00
aozhiwei
72abfd9f94 1 2024-06-01 17:35:47 +08:00
aozhiwei
aa5e6661fc 1 2024-06-01 17:23:29 +08:00
2 changed files with 27 additions and 2 deletions

View File

@ -73,6 +73,11 @@ public:
} }
} }
virtual void OnConnect() override
{
f8::UdpLog::Instance()->Warning("OnConnect socket_handle:%d", {socket_handle});
}
virtual void OnRawHttpGet(const std::string& url, const std::string& querystr, virtual void OnRawHttpGet(const std::string& url, const std::string& querystr,
std::string& response) override std::string& response) override
{ {
@ -91,6 +96,7 @@ public:
virtual void OnDisConnect() override virtual void OnDisConnect() override
{ {
f8::UdpLog::Instance()->Warning("OnDisConnect socket_handle:%d", {socket_handle});
f8::MsgQueue::Instance()->PostMsg f8::MsgQueue::Instance()->PostMsg
(IM_ClientSocketDisconnect, (IM_ClientSocketDisconnect,
a8::Args a8::Args
@ -241,7 +247,7 @@ void GGListener::RemoveSocketDisconnectHandler(std::weak_ptr<SocketDisconnectHan
p->cb = nullptr; p->cb = nullptr;
p->holder = nullptr; p->holder = nullptr;
#if 1 #if 1
f8::UdpLog::Instance()->Warning("RemoveSocketDisconnectHandler socket_handle%d time:%d", f8::UdpLog::Instance()->Warning("RemoveSocketDisconnectHandler socket_handle:%d time:%d",
{ {
p->socket_handle, p->socket_handle,
a8::XGetTickCount() - p->add_tick a8::XGetTickCount() - p->add_tick
@ -253,5 +259,17 @@ void GGListener::RemoveSocketDisconnectHandler(std::weak_ptr<SocketDisconnectHan
void GGListener::OnClientDisconnect(int socket_handle) void GGListener::OnClientDisconnect(int socket_handle)
{ {
auto itr = disconnect_listener_hash_.find(socket_handle);
if (itr != disconnect_listener_hash_.end()) {
std::vector<std::weak_ptr<SocketDisconnectHandler>> del_handlers;
SocketDisconnectHandler *handle = nullptr, *tmp = nullptr;
list_for_each_entry_safe(handle, tmp, &itr->second, entry) {
del_handlers.push_back(handle->holder);
handle->cb(a8::Args({itr->first}));
}
for (auto handler : del_handlers) {
RemoveSocketDisconnectHandler(handler);
}
}
PlayerMgr::Instance()->OnClientDisconnect(socket_handle); PlayerMgr::Instance()->OnClientDisconnect(socket_handle);
} }

View File

@ -78,6 +78,13 @@ void RoomMgr::_CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg)
{ {
#ifdef MYDEBUG #ifdef MYDEBUG
a8::XPrintf("CMJoin socket_handle:%d\n", {hdr->socket_handle}); a8::XPrintf("CMJoin socket_handle:%d\n", {hdr->socket_handle});
#endif
#if 1
f8::UdpLog::Instance()->Warning("CMJoin account_id:%s socket_handle:%d",
{
msg.account_id(),
hdr->socket_handle,
});
#endif #endif
if (IsLimitJoin()) { if (IsLimitJoin()) {
JoinErrorHandle(msg, 2, hdr->socket_handle); JoinErrorHandle(msg, 2, hdr->socket_handle);
@ -87,7 +94,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg)
auto member = GetCustomMemberBySocket(hdr->socket_handle); auto member = GetCustomMemberBySocket(hdr->socket_handle);
if (member) { if (member) {
#if 1 #if 1
f8::UdpLog::Instance()->Warning("JoinError socket_not_exits socket_handle%d", f8::UdpLog::Instance()->Warning("JoinError socket already exits socket_handle:%d",
{ {
hdr->socket_handle, hdr->socket_handle,
}); });