Skip to content

Commit 6f1ab9f

Browse files
committed
fix compile issues with voice connection
1 parent 71f4b85 commit 6f1ab9f

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

include/sleepy_discord/asio_websocketconnection.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "endian.h"
2525
#include "version_helper.h"
2626

27-
// to do: handle muliple frames in one read
2827
// to do: use a log event and remove iostream include
2928

3029
namespace SleepyDiscord {

sleepy_discord/client.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -740,14 +740,13 @@ namespace SleepyDiscord {
740740
}
741741

742742
void BaseDiscordClient::processMessage(const WebSocketMessage message) {
743-
switch (message.opCode) {
744-
case WebSocketMessage::OPCode::binary: {
743+
if (useTrasportConnection != -1) {
745744
if (!compressionHandler)
746-
break;
745+
return;
747746
compressionHandler->uncompress(message.payload);
748747

749748
//when using transport connections, Discord ends streams the flush siginal
750-
constexpr std::array<const char, 4> flushSiginal = { 0, 0, '\xFF', '\xFF'};
749+
constexpr std::array<const char, 4> flushSiginal = { 0, 0, '\xFF', '\xFF' };
751750
constexpr std::size_t siginalLength = flushSiginal.max_size();
752751
bool endsWithFlushSiginal = false;
753752
if (useTrasportConnection == 1 && siginalLength <= message.payload.length()) {
@@ -765,13 +764,10 @@ namespace SleepyDiscord {
765764
compressionHandler->getOutput(*uncompressed);
766765
processMessage(*uncompressed);
767766
}
768-
break;
769-
}
770-
case WebSocketMessage::OPCode::text: {
767+
return;
768+
} else {
771769
processMessage(message.payload);
772-
break;
773-
}
774-
default: break;
770+
return;
775771
}
776772
}
777773

@@ -897,7 +893,7 @@ namespace SleepyDiscord {
897893
voiceConnections.emplace_front( this, context );
898894
VoiceConnection& voiceConnection = voiceConnections.front();
899895

900-
connect(endpoint, &voiceConnection, voiceConnection.connection);
896+
connect(endpoint, voiceConnection, voiceConnection.connection);
901897

902898
//remove from wait list
903899
waitingVoiceContexts.remove_if(

sleepy_discord/voice_connection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ namespace SleepyDiscord {
210210
if (reconnectTimer.isValid()) //overwrite reconnect timer
211211
reconnectTimer.stop();
212212
reconnectTimer = origin->schedule([this]() {
213-
origin->connect(getWebSocketURI(context.endpoint), this, connection);
213+
origin->connect(getWebSocketURI(context.endpoint), *this, connection);
214214
}, getRetryDelay());
215215
++consecutiveReconnectsCount;
216216
}

0 commit comments

Comments
 (0)