From 77fb68fc0b528beef12dd07a8445ef2fcf635074 Mon Sep 17 00:00:00 2001 From: Tom Steer Date: Wed, 18 Nov 2020 14:29:22 -0600 Subject: [PATCH 1/2] Set TTL to 60 Test build for Rangers with increased TTL --- src/sacn/sacnsocket.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sacn/sacnsocket.cpp b/src/sacn/sacnsocket.cpp index 7e29706b..f21a77c3 100644 --- a/src/sacn/sacnsocket.cpp +++ b/src/sacn/sacnsocket.cpp @@ -98,6 +98,8 @@ bool sACNTxSocket::bind() setSocketOption(QAbstractSocket::MulticastLoopbackOption, QVariant(0)); #endif + setSocketOption(QAbstractSocket::MulticastTtlOption, QVariant(60)); + setMulticastInterface(m_interface); qDebug() << "sACNTxSocket " << QThread::currentThreadId() << ": Bound to interface:" << multicastInterface().name(); } From 1afaf1f587bf7d3da1a9a39121b42d15c5867859 Mon Sep 17 00:00:00 2001 From: Tom Steer Date: Thu, 19 Nov 2020 10:06:06 -0600 Subject: [PATCH 2/2] Add a preference for Multicast TTL Add a preferences option for the TTL of multicast datagrams sent --- src/preferences.cpp | 3 ++ src/preferences.h | 4 ++ src/preferencesdialog.cpp | 9 +++++ src/sacn/sacnsocket.cpp | 3 +- ui/preferencesdialog.ui | 79 +++++++++++++++++++++++---------------- 5 files changed, 65 insertions(+), 33 deletions(-) diff --git a/src/preferences.cpp b/src/preferences.cpp index 29b1ff06..8e086b2c 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -283,6 +283,8 @@ void Preferences::savePreferences() settings.setValue(S_PRIORITYPRESET.arg(i), QVariant(m_priorityPresets[i])); } + settings.setValue(S_MULTICASTTTL, m_multicastTtl); + settings.sync(); } @@ -318,6 +320,7 @@ void Preferences::loadPreferences() m_txrateoverride = settings.value(S_TX_RATE_OVERRIDE, QVariant(false)).toBool(); m_locale = settings.value(S_LOCALE, QLocale::system()).toLocale(); m_universesListed = settings.value(S_UNIVERSESLISTED, QVariant(20)).toUInt(); + m_multicastTtl = settings.value(S_MULTICASTTTL, QVariant(1)).toUInt(); m_windowInfo.clear(); int size = settings.beginReadArray(S_SUBWINDOWLIST); diff --git a/src/preferences.h b/src/preferences.h index 23bf86c0..a32cf080 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -47,6 +47,7 @@ static const QString S_TX_RATE_OVERRIDE("TX Rate Override"); static const QString S_LOCALE("LOCALE"); static const QString S_UNIVERSESLISTED("Universe List Count"); static const QString S_PRIORITYPRESET("PriorityPreset %1"); +static const QString S_MULTICASTTTL("Multicast TTL"); struct MDIWindowInfo { @@ -125,6 +126,7 @@ class Preferences void SetLocale(QLocale locale); void SetUniversesListed(quint8 count) { m_universesListed = (std::max)(count, (quint8)1); } void SetPriorityPreset(const QByteArray &data, int index); + void SetMulticastTtl(quint8 ttl) { m_multicastTtl = ttl;} unsigned int GetDisplayFormat(); unsigned int GetMaxLevel(); @@ -142,6 +144,7 @@ class Preferences bool GetTXRateOverride() { return m_txrateoverride; } QLocale GetLocale(); quint8 GetUniversesListed() { return m_universesListed; } + quint8 GetMulticastTtl() { return m_multicastTtl; } QString GetFormattedValue(unsigned int nLevelInDecimal, bool decorated = false); QByteArray GetPriorityPreset(int index); @@ -173,6 +176,7 @@ public slots: QLocale m_locale; quint8 m_universesListed; QByteArray m_priorityPresets[PRIORITYPRESET_COUNT]; + quint8 m_multicastTtl; void loadPreferences(); }; diff --git a/src/preferencesdialog.cpp b/src/preferencesdialog.cpp index bf06e0a3..407be94e 100644 --- a/src/preferencesdialog.cpp +++ b/src/preferencesdialog.cpp @@ -101,6 +101,8 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) : ui->cbTheme->clear(); ui->cbTheme->addItems(Preferences::ThemeDescriptions()); ui->cbTheme->setCurrentIndex(static_cast(Preferences::getInstance()->GetTheme())); + + ui->sbMulticastTtl->setValue(Preferences::getInstance()->GetMulticastTtl()); } PreferencesDialog::~PreferencesDialog() @@ -180,6 +182,13 @@ void PreferencesDialog::on_buttonBox_accepted() requiresRestart = true; } + // Multicast TTL + if(p->GetMulticastTtl() != ui->sbMulticastTtl->value()) + { + p->SetMulticastTtl(ui->sbMulticastTtl->value()); + requiresRestart = true; + } + // Resstart to apply? if (requiresRestart) { QMessageBox::information(this, tr("Restart requied"), diff --git a/src/sacn/sacnsocket.cpp b/src/sacn/sacnsocket.cpp index f21a77c3..2286aef1 100644 --- a/src/sacn/sacnsocket.cpp +++ b/src/sacn/sacnsocket.cpp @@ -22,6 +22,7 @@ #include "streamcommon.h" #include "streamingacn.h" #include "sacnlistener.h" +#include "preferences.h" sACNRxSocket::sACNRxSocket(QNetworkInterface iface, QObject *parent) : QUdpSocket(parent), @@ -98,7 +99,7 @@ bool sACNTxSocket::bind() setSocketOption(QAbstractSocket::MulticastLoopbackOption, QVariant(0)); #endif - setSocketOption(QAbstractSocket::MulticastTtlOption, QVariant(60)); + setSocketOption(QAbstractSocket::MulticastTtlOption, QVariant(Preferences::getInstance()->GetMulticastTtl())); setMulticastInterface(m_interface); qDebug() << "sACNTxSocket " << QThread::currentThreadId() << ": Bound to interface:" << multicastInterface().name(); diff --git a/ui/preferencesdialog.ui b/ui/preferencesdialog.ui index 1c4c620a..013417b1 100644 --- a/ui/preferencesdialog.ui +++ b/ui/preferencesdialog.ui @@ -6,8 +6,8 @@ 0 0 - 639 - 452 + 653 + 491 @@ -256,52 +256,54 @@ Transmit Options - - - + + + + + Default Source Name + + + + + + + Multicast TTL* + + + + + - + 0 0 - - Default Source Name + + 0 + + + 255 - - - - - - 0 - 0 - - - - 63 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - + + - + 0 0 - - Allow rates to exceed E1.11 (E1.31:2016 6.6.1)* + + 63 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + @@ -437,6 +439,19 @@ + + + + + 0 + 0 + + + + Allow rates to exceed E1.11 (E1.31:2016 6.6.1)* + + +