コード例 #1
0
void Chatserver::tick()
{
	std::cout << "Chatserver::tick(" << ++tickCounter << "), currently " << numberOfFriends() << " friends." << std::endl;

	if (tickCounter % checkForNewCertsInterval == 0)
		checkForNewCertificates();

	if (tickCounter == ticksUntilLobbiesAreCreated)
	{
		std::vector<VisibleChatLobbyRecord> dummy;
		// called it to trigger that all friends are asked
		rsMsgs->getListOfNearbyChatLobbies(dummy);
	}

	if (tickCounter == ticksUntilLobbiesAreCreated + 10)
		createOrRejoinLobbys();

	if (numberOfFriends() > maxFriends)
		removeOldestFriend();
}
コード例 #2
0
void Chatserver::removeOldestFriend()
{
	std::cout << "ChatServer::removeOldestFriend()" << std::endl;

	while (numberOfFriends() > maxFriends)
	{
		if (!rsPeers->removeFriend(friends.front()))
		{
			std::cout << "FATAL: Could not remove friend with id " << friends.front() << std::endl;
		}
		friends.pop_front();
	};
	saveChatServerStore();
}