void CComputerInfo::SetComputerStatus(ECOMPUTERSTATUS newVal) { if (ECS_OFFLINE == newVal) { m_strClientVersion.Empty(); m_strComputerName.Empty(); //如果当前是解屏状态,则不更新为离线 if (GetComputerStatus() == ECS_UNLOCK) { return; } } else if (ECS_UNLOCK == newVal) { m_nNetbarID = 0; m_bHasUserInfo = FALSE; } else if (ECS_THIEF == newVal) { m_Status = TERM_THIEF; if (HasClient()) { return; } } m_ComputerStatus = newVal; }
void RoomMgr::ClientRemove(const std::string& roomName, int clientId) { if (Exists(roomName) && HasClient(roomName, clientId)) { try { auto room = rooms.at(roomName); if (room) { room->clients.erase(clientId); // If there are no users left in the room, delete it. if (room->clients.size() == 0) { rooms.erase(room->name); } } } catch (std::exception& e) { std::cerr << "Problem while getting room during leave: " << e.what() << std::endl; } } else { std::cerr << "Client " << clientId << " no longer in room " << roomName << " during ClientRemove." << std::endl; } }
bool cSocketThreads::cSocketThread::NotifyWrite(const cCallback * a_Client) { ASSERT(m_Parent->m_CS.IsLockedByCurrentThread()); if (HasClient(a_Client)) { // Notify the thread that there's another packet in the queue: ASSERT(m_ControlSocket2.IsValid()); m_ControlSocket2.Send("q", 1); return true; } return false; }
bool RoomMgr::ClientAdd(const std::string& roomName, std::shared_ptr<IClient> client) { if (Exists(roomName) && !HasClient(roomName, client->clientId)) { auto room = rooms.at(roomName); if (room) { room->clients.insert({ client->clientId, client }); client->currRoomName = roomName; return true; } } // All other cases result in failure to join room and return false. return false; }
void AddClient(CClient& client) { if (HasClient(client) == false) { m_vClients.push_back(&client); } }