This commit is contained in:
aozhiwei 2024-08-28 11:19:47 +08:00
parent 2412079864
commit 6495be8f92

View File

@ -254,4 +254,14 @@ void GGListener::RemoveSocketDisconnectHandler(std::weak_ptr<SocketDisconnectHan
void GGListener::OnClientDisconnect(int socket_handle) void GGListener::OnClientDisconnect(int socket_handle)
{ {
PlayerMgr::Instance()->OnClientDisconnect(socket_handle); PlayerMgr::Instance()->OnClientDisconnect(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}));
}
disconnect_listener_hash_.erase(itr);
}
} }