diff --git a/.gitignore b/.gitignore index 1c85d0e..5d95bde 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea cmake-build-* +assets diff --git a/CMakeLists.txt b/CMakeLists.txt index dcbf533..848c1bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,4 +56,4 @@ target_link_libraries(M2-PT-DRP PRIVATE ${MPG123_LIBRARIES} ${PORTAUDIO_LIBRARIES} ${OPENSSL_LIBRARIES} -) \ No newline at end of file +) diff --git a/Dockerfile b/Dockerfile index 59c545a..079ee26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ FROM alpine:latest RUN apk add gcc g++ cmake ninja -RUN apk add mpg123-dev openssl-dev portaudio-dev +RUN apk add mpg123-dev openssl-dev alsa-lib alsa-utils portaudio-dev pulseaudio-alsa alsa-plugins-pulse pulseaudio pulseaudio-utils + +RUN echo "pcm.!default pulse\nctl.!default pulse" > /root/.asoundrc WORKDIR /app COPY . /app diff --git a/source/EventManager.cpp b/source/EventManager.cpp index a1a3ce1..389d43c 100644 --- a/source/EventManager.cpp +++ b/source/EventManager.cpp @@ -40,7 +40,7 @@ EventManager::EventManager() { // hints for the communication addrinfo addressHints {}; - addressHints.ai_family = AF_INET; // TODO: AF_INET6 + addressHints.ai_family = AF_INET6; addressHints.ai_socktype = SOCK_DGRAM; addressHints.ai_protocol = IPPROTO_UDP; @@ -57,7 +57,7 @@ EventManager::EventManager() { // get the information for the broadcast local-link address // TODO(Faraphel): ip / port as argument ? if(const int error = getaddrinfo( - "0.0.0.0", // TODO: ff02::1 + "ff02::1", "5650", &addressHints, &context.broadcastAddressInfo @@ -105,7 +105,7 @@ void EventManager::loopSender() { // get the information for the broadcast local-link address // TODO(Faraphel): ip / port as argument ? if(const int error = getaddrinfo( - "localhost", // TODO: ff02::1 + "ff02::1", "5650", &addressHints, &destinationInfo @@ -148,7 +148,7 @@ void EventManager::loopReceiver() { // TODO(Faraphel): port as argument addrinfo* senderInfo; if(getaddrinfo( - "0.0.0.0", // hostname + "ff02::1", // hostname "5650", // port &addressHints, &senderInfo diff --git a/source/tasks/undefined/UndefinedTask.cpp b/source/tasks/undefined/UndefinedTask.cpp index 2bf20d9..5325b4d 100644 --- a/source/tasks/undefined/UndefinedTask.cpp +++ b/source/tasks/undefined/UndefinedTask.cpp @@ -6,8 +6,7 @@ #include #include #include -#include -#include +#include #include #include "../../Context.hpp" @@ -43,9 +42,8 @@ void UndefinedTask::handle(Context& context) { // TODO(Faraphel): should use the machine with the lowest average ping if (context.me.serverEnabled) { // find the remote peer with the highest id that can be a server - const auto serverCandidate = std::max_element( - context.remotePeers.begin(), - context.remotePeers.end(), + const auto serverCandidate = std::ranges::max_element( + context.remotePeers, [&](auto& remotePeer1, auto& remotePeer2) { return ( (remotePeer1.second->information.serverEnabled ? remotePeer1.first : 0) <