유저 연결이 끊어졌을 시에 방에서도 나가도록 수정

This commit is contained in:
2025-05-10 01:33:29 +09:00
parent 6c1b0c6852
commit 65b7aa8f6e

View File

@@ -6,8 +6,14 @@ namespace Chattr {
void ServerManager::_IOCPClient(Chattr::ThreadPool* thread, Chattr::IOCPPASSINDATA* data) {
if (data->event == IOCPEVENT::QUIT) {
if (userSocket2UID_.find(data->socket) != userSocket2UID_.end())
if (userSocket2UID_.find(data->socket) != userSocket2UID_.end()) {
for (auto room : rooms_) {
if (room.second.find(userSocket2UID_[data->socket]) != room.second.end()) {
exitRoom(userSocket2UID_[data->socket], room.first);
}
}
deleteUser(userSocket2UID_[data->socket]);
}
delete data;
return;
}