From 7d4dcd168d94e18ea30c5d080615459a4165c5d6 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Tue, 14 Dec 2021 10:53:57 +0100 Subject: [PATCH] REFAC(server): Removed dead code msgUDPTunnel This message type is explicitly handled before calling into the different msg* implementations. Therefore, msgUDPTunnel could never be called in the current state of the code base. However, we can't remove the implementation completely, because of the macro voodoo that is used to declare and switch over the different message types (we can't remove the entry from the macro, since in there we still need it for defining the respective enum entry). --- src/murmur/Messages.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/murmur/Messages.cpp b/src/murmur/Messages.cpp index 352fbcc0e..feff38a76 100644 --- a/src/murmur/Messages.cpp +++ b/src/murmur/Messages.cpp @@ -635,23 +635,10 @@ void Server::msgServerSync(ServerUser *, MumbleProto::ServerSync &) { void Server::msgPermissionDenied(ServerUser *, MumbleProto::PermissionDenied &) { } -void Server::msgUDPTunnel(ServerUser *uSource, MumbleProto::UDPTunnel &msg) { - ZoneScoped; - - MSG_SETUP_NO_UNIDLE(ServerUser::Authenticated); - - const std::string &str = msg.packet(); - int len = static_cast< int >(str.length()); - if (len < 1) - return; - QReadLocker rl(&qrwlVoiceThread); - if (m_tcpTunnelDecoder.decode(gsl::span< const Mumble::Protocol::byte >( - reinterpret_cast< const Mumble::Protocol::byte * >(str.data()), str.size())) - && m_tcpTunnelDecoder.getMessageType() == Mumble::Protocol::UDPMessageType::Audio) { - Mumble::Protocol::AudioData audioData = m_tcpTunnelDecoder.getAudioData(); - - processMsg(uSource, audioData, m_tcpAudioReceivers, m_tcpAudioEncoder); - } +void Server::msgUDPTunnel(ServerUser *, MumbleProto::UDPTunnel &) { + // This code should be unreachable + assert(false); + qWarning("Messages: Reached theoretically unreachable function msgUDPTunnel"); } void Server::msgUserState(ServerUser *uSource, MumbleProto::UserState &msg) {