Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT(server): Flag bot connections, so user count does not get inflated by them #5948

Merged
merged 1 commit into from
Nov 27, 2022

Conversation

martinv98
Copy link

Extended Authenticate message by int client_type in Mumble.proto so server knows what type of connection it is(for now it's just 0 for REGULAR and 1 for BOT). Next I created header file called ClientType.h where I define enum class for types of connections. This enum is easily extendable for any special connection types in future.

In Server.h I extended Server class by m_botCount attribute.

In Messages.cpp I extended msgAuthenticate function by a check at the end before authentication log that checks whether connection type is regular or bot and if it's a bot then it increments m_botCount by one. It also sets client_type for ServerUser.

Before disconnect in Server.cpp I check if ServerUser is BOT and if yes I decrement m_botCount by one. In the final user count, m_botCount gets subtracted from the user count to show real user count.

Implements #5461

Checks

src/Mumble.proto Outdated Show resolved Hide resolved
src/murmur/ClientType.h Outdated Show resolved Hide resolved
src/murmur/Server.cpp Outdated Show resolved Hide resolved
src/murmur/Messages.cpp Outdated Show resolved Hide resolved
@Krzmbrzl Krzmbrzl added server feature-request This issue or PR deals with a new feature labels Nov 13, 2022
@Krzmbrzl Krzmbrzl linked an issue Nov 27, 2022 that may be closed by this pull request
This commit introduces a new flag that connecting clients can use to
tell the server they are connecting to that they consider themselves bot
clients. This information can then be used (as is the case for the
official server implementation) to e.g. correct the reported user count
on the server to only include "real" clients - aka: no bots.

Fixes mumble-voip#5461
Copy link
Member

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for having taken so long to process your PR.
It is looking good now. I took the liberty of running clang-format on your changes and squashing the commits into a single one (with extended description) for you.

@Krzmbrzl Krzmbrzl merged commit fc4db91 into mumble-voip:master Nov 27, 2022
@Krzmbrzl
Copy link
Member

Thank you for implementing this 👍

@TheFatherMind
Copy link

You are awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This issue or PR deals with a new feature server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flag bot connections, so user count does not get inflated by them
5 participants