Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CClient::CClient ( const quint16 iPortNumber,
const QString& strConnOnStartupAddress,
const bool bNoAutoJackConnect,
const QString& strNClientName,
const bool bNEnableIPv6,
const bool bNDisableIPv6,
const bool bNMuteMeInPersonalMix ) :
ChannelInfo(),
strClientName ( strNClientName ),
Expand All @@ -50,7 +50,8 @@ CClient::CClient ( const quint16 iPortNumber,
bIsInitializationPhase ( true ),
bMuteOutStream ( false ),
fMuteOutStreamGain ( 1.0f ),
Socket ( &Channel, iPortNumber, iQosNumber, "", bNEnableIPv6 ),
bIPv6Available ( false ),
Copy link
Copy Markdown
Member

@ann0see ann0see May 30, 2026

Choose a reason for hiding this comment

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

Personal preference would be to have this flipped assuming IPv6 availability is there by default and we only set it to false in case we see it isn't. That would be more in line with the default enabled idea.

Copy link
Copy Markdown
Member Author

@softins softins May 30, 2026

Choose a reason for hiding this comment

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

This boolean is internal only, not for user-facing presentation, and I feel this way round makes the logic cleaner. This is my reasoning:

  1. We can safely assume all systems are IPv4 capable, but not necessarily IPv6 capable. So that makes the starting point ipv6avail = false
  2. The first thing we do, unless the user has explicitly told us not to, it attempt to create a v6-capable socket.
  3. If we succeed in doing so, we can set the ipv6avail flag to true.
  4. At this point, if the flag is still false (whether by user command or failure), we know we need to create a v4 socket.

I think to invert that logic would probably result in some unnecessary else clauses, and make the flow less tidy. I can't see a good reason to do so.

Socket ( &Channel, iPortNumber, iQosNumber, "", bNDisableIPv6, bIPv6Available ),
Sound ( AudioCallback, this, bNoAutoJackConnect, strNClientName ),
iAudioInFader ( AUD_FADER_IN_MIDDLE ),
bReverbOnLeftChan ( false ),
Expand All @@ -68,7 +69,6 @@ CClient::CClient ( const quint16 iPortNumber,
bEnableAudioAlerts ( false ),
bEnableOPUS64 ( false ),
bJitterBufferOK ( true ),
bEnableIPv6 ( bNEnableIPv6 ),
bMuteMeInPersonalMix ( bNMuteMeInPersonalMix ),
iServerSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL ),
bRawAudioIsSupported ( false )
Expand Down Expand Up @@ -599,7 +599,7 @@ void CClient::SetRemoteChanPan ( const int iId, const float fPan )
bool CClient::SetServerAddr ( QString strNAddr )
{
CHostAddress HostAddress;
if ( NetworkUtil::ParseNetworkAddress ( strNAddr, HostAddress, bEnableIPv6 ) )
if ( NetworkUtil::ParseNetworkAddress ( strNAddr, HostAddress, bIPv6Available ) )
{
// apply address to the channel
Channel.SetAddress ( HostAddress );
Expand Down
10 changes: 7 additions & 3 deletions src/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class CClient : public QObject
const QString& strConnOnStartupAddress,
const bool bNoAutoJackConnect,
const QString& strNClientName,
const bool bNEnableIPv6,
const bool bNDisableIPv6,
const bool bNMuteMeInPersonalMix );

virtual ~CClient();
Expand All @@ -142,6 +142,9 @@ class CClient : public QObject
bool IsCallbackEntered() const { return Sound.IsCallbackEntered(); }
bool SetServerAddr ( QString strNAddr );

// IPv6 Available
bool IsIPv6Available() { return bIPv6Available; }

double GetLevelForMeterdBLeft() { return SignalLevelMeter.GetLevelForMeterdBLeftOrMono(); }
double GetLevelForMeterdBRight() { return SignalLevelMeter.GetLevelForMeterdBRight(); }

Expand Down Expand Up @@ -369,7 +372,9 @@ class CClient : public QObject
float fMuteOutStreamGain;
CVector<unsigned char> vecCeltData;

CHighPrioSocket Socket;
bool bIPv6Available; // must be before Socket - passed by reference to Socket
CHighPrioSocket Socket;

CSound Sound;
CStereoSignalLevelMeter SignalLevelMeter;

Expand Down Expand Up @@ -405,7 +410,6 @@ class CClient : public QObject
bool bEnableOPUS64;

bool bJitterBufferOK;
bool bEnableIPv6;
bool bMuteMeInPersonalMix;
QMutex MutexDriverReinit;

Expand Down
8 changes: 3 additions & 5 deletions src/clientdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,17 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
const bool bNewShowComplRegConnList,
const bool bShowAnalyzerConsole,
const bool bMuteStream,
const bool bNEnableIPv6,
QWidget* parent ) :
CBaseDlg ( parent, Qt::Window ), // use Qt::Window to get min/max window buttons
pClient ( pNCliP ),
pSettings ( pNSetP ),
bConnectDlgWasShown ( false ),
bDetectFeedback ( false ),
bEnableIPv6 ( bNEnableIPv6 ),
eLastRecorderState ( RS_UNDEFINED ), // for SetMixerBoardDeco
eLastDesign ( GD_DEFAULT ), // "
ClientSettingsDlg ( pNCliP, pNSetP, parent ),
ChatDlg ( parent ),
ConnectDlg ( pNSetP, bNewShowComplRegConnList, bNEnableIPv6, parent ),
ConnectDlg ( pNCliP, pNSetP, bNewShowComplRegConnList, parent ),
AnalyzerConsole ( pNCliP, parent )
{
setupUi ( this );
Expand Down Expand Up @@ -597,12 +595,12 @@ CClientDlg::CClientDlg ( CClient* pNCliP,

// Don't use SRV resolution when resolving update servers.

if ( NetworkUtil::ParseNetworkAddressBare ( UPDATECHECK1_ADDRESS, UpdateServerHostAddress, bEnableIPv6 ) )
if ( NetworkUtil::ParseNetworkAddressBare ( UPDATECHECK1_ADDRESS, UpdateServerHostAddress, pClient->IsIPv6Available() ) )
{
pClient->CreateCLServerListReqVerAndOSMes ( UpdateServerHostAddress );
}

if ( NetworkUtil::ParseNetworkAddressBare ( UPDATECHECK2_ADDRESS, UpdateServerHostAddress, bEnableIPv6 ) )
if ( NetworkUtil::ParseNetworkAddressBare ( UPDATECHECK2_ADDRESS, UpdateServerHostAddress, pClient->IsIPv6Available() ) )
{
pClient->CreateCLServerListReqVerAndOSMes ( UpdateServerHostAddress );
}
Expand Down
2 changes: 0 additions & 2 deletions src/clientdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase
const bool bNewShowComplRegConnList,
const bool bShowAnalyzerConsole,
const bool bMuteStream,
const bool bNEnableIPv6,
QWidget* parent = nullptr );

protected:
Expand All @@ -108,7 +107,6 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase
bool bConnected;
bool bConnectDlgWasShown;
bool bDetectFeedback;
bool bEnableIPv6;
ERecorderState eLastRecorderState;
EGUIDesign eLastDesign;
QTimer TimerSigMet;
Expand Down
10 changes: 6 additions & 4 deletions src/connectdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ bool CMappedTreeWidgetItem::operator<( const QTreeWidgetItem& other ) const
return lhs.toString() < rhs.toString();
}

CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteRegList, const bool bNEnableIPv6, QWidget* parent ) :
CConnectDlg::CConnectDlg ( CClient* pNCliP, CClientSettings* pNSetP, const bool bNewShowCompleteRegList, QWidget* parent ) :
CBaseDlg ( parent, Qt::Dialog ),
pClient ( pNCliP ),
pSettings ( pNSetP ),
strSelectedAddress ( "" ),
strSelectedServerName ( "" ),
Expand All @@ -110,8 +111,7 @@ CConnectDlg::CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteR
bReducedServerListReceived ( false ),
bServerListItemWasChosen ( false ),
bListFilterWasActive ( false ),
bShowAllMusicians ( true ),
bEnableIPv6 ( bNEnableIPv6 )
bShowAllMusicians ( true )
{
setupUi ( this );

Expand Down Expand Up @@ -870,7 +870,9 @@ void CConnectDlg::OnTimerPing()
// try to parse host address string which is stored as user data
// in the server list item GUI control element
// the data to be parsed is just IP:port, so no SRV discovery is needed
if ( NetworkUtil::ParseNetworkAddressBare ( pCurListViewItem->data ( LVC_NAME, Qt::UserRole ).toString(), haServerAddress, bEnableIPv6 ) )
if ( NetworkUtil::ParseNetworkAddressBare ( pCurListViewItem->data ( LVC_NAME, Qt::UserRole ).toString(),
haServerAddress,
pClient->IsIPv6Available() ) )
{
// if address is valid, send ping message using a new thread
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
Expand Down
4 changes: 2 additions & 2 deletions src/connectdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CConnectDlg : public CBaseDlg, private Ui_CConnectDlgBase
Q_OBJECT

public:
CConnectDlg ( CClientSettings* pNSetP, const bool bNewShowCompleteRegList, const bool bNEnableIPv6, QWidget* parent = nullptr );
CConnectDlg ( CClient* pNCliP, CClientSettings* pNSetP, const bool bNewShowCompleteRegList, QWidget* parent = nullptr );

void SetShowAllMusicians ( const bool bState ) { ShowAllMusicians ( bState ); }
bool GetShowAllMusicians() { return bShowAllMusicians; }
Expand Down Expand Up @@ -105,6 +105,7 @@ class CConnectDlg : public CBaseDlg, private Ui_CConnectDlgBase
void EmitCLServerListPingMes ( const CHostAddress& haServerAddress, const bool bNeedVersion );
void UpdateDirectoryComboBox();

CClient* pClient;
CClientSettings* pSettings;

QTimer TimerPing;
Expand All @@ -119,7 +120,6 @@ class CConnectDlg : public CBaseDlg, private Ui_CConnectDlgBase
bool bServerListItemWasChosen;
bool bListFilterWasActive;
bool bShowAllMusicians;
bool bEnableIPv6;

public slots:
void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int );
Expand Down
27 changes: 11 additions & 16 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ int main ( int argc, char** argv )
bool bNoAutoJackConnect = false;
bool bUseTranslation = true;
bool bCustomPortNumberGiven = false;
bool bEnableIPv6 = false;
bool bDisableIPv6 = false;
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
quint16 iPortNumber = DEFAULT_PORT_NUMBER;
int iJsonRpcPortNumber = INVALID_PORT;
Expand Down Expand Up @@ -242,11 +242,11 @@ int main ( int argc, char** argv )
}

// Enable IPv6 ---------------------------------------------------------
if ( GetFlagArgument ( argv, i, "-6", "--enableipv6" ) )
if ( GetFlagArgument ( argv, i, "--noipv6", "--noipv6" ) )
{
bEnableIPv6 = true;
qInfo() << "- IPv6 enabled";
CommandLineOptions << "--enableipv6";
bDisableIPv6 = true;
qInfo() << "- IPv6 disabled";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd like that this makes clear that disabling IPv6 is not recommended. Maybe add (this is not recommended)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Probably better in the documentation. It could get a bit wearing telling the user off every time when it's a conscious decision that has been made.

CommandLineOptions << "--noipv6";
continue;
}

Expand Down Expand Up @@ -935,7 +935,8 @@ int main ( int argc, char** argv )
#ifndef SERVER_ONLY
if ( bIsClient )
{
CClient Client ( iPortNumber, iQosNumber, strConnOnStartupAddress, bNoAutoJackConnect, strClientName, bEnableIPv6, bMuteMeInPersonalMix );
CClient
Client ( iPortNumber, iQosNumber, strConnOnStartupAddress, bNoAutoJackConnect, strClientName, bDisableIPv6, bMuteMeInPersonalMix );

// Create Settings with the client pointer
CClientSettings Settings ( &Client, strIniFileName );
Expand All @@ -960,14 +961,8 @@ int main ( int argc, char** argv )
}

// GUI object
CClientDlg ClientDlg ( &Client,
&Settings,
strConnOnStartupAddress,
bShowComplRegConnList,
bShowAnalyzerConsole,
bMuteStream,
bEnableIPv6,
nullptr );
CClientDlg
ClientDlg ( &Client, &Settings, strConnOnStartupAddress, bShowComplRegConnList, bShowAnalyzerConsole, bMuteStream, nullptr );

// show dialog
ClientDlg.show();
Expand Down Expand Up @@ -1007,7 +1002,7 @@ int main ( int argc, char** argv )
bUseMultithreading,
bDisableRecording,
bDelayPan,
bEnableIPv6,
bDisableIPv6,
eLicenceType );

#ifndef NO_JSON_RPC
Expand Down Expand Up @@ -1109,7 +1104,7 @@ QString UsageArguments ( char** argv )
" -Q, --qos set the QoS value. Default is 128. Disable with 0\n"
" (see the Jamulus website to enable QoS on Windows)\n"
" -t, --notranslation disable translation (use English language)\n"
" -6, --enableipv6 enable IPv6 addressing (IPv4 is always enabled)\n"
" --noipv6 disable IPv6 addressing (IPv4 is always enabled)\n"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
" --noipv6 disable IPv6 addressing (IPv4 is always enabled)\n"
" --noipv6 disable IPv6 addressing (only set this in case you have issues with IPv6. IPv4 is always enabled)\n"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Seems a bit verbose for a usage message, and probably better put in the documentation. Most people will probably not even be aware of IPv6, apart from the most technical.

"\n"
"Server only:\n"
" -d, --discononquit disconnect all Clients on quit\n"
Expand Down
10 changes: 5 additions & 5 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,33 @@ CServer::CServer ( const int iNewMaxNumChan,
const bool bNUseMultithreading,
const bool bDisableRecording,
const bool bNDelayPan,
const bool bNEnableIPv6,
const bool bNDisableIPv6,
const ELicenceType eNLicenceType ) :
bUseDoubleSystemFrameSize ( bNUseDoubleSystemFrameSize ),
bUseMultithreading ( bNUseMultithreading ),
iMaxNumChannels ( iNewMaxNumChan ),
iCurNumChannels ( 0 ),
bDisableRaw ( bNDisableRaw ),
Socket ( this, iPortNumber, iQosNumber, strServerBindIP, bNEnableIPv6 ),
bIPv6Available ( false ),
Socket ( this, iPortNumber, iQosNumber, strServerBindIP, bNDisableIPv6, bIPv6Available ),
Logging(),
iFrameCount ( 0 ),
bWriteStatusHTMLFile ( false ),
strServerHTMLFileListName ( strHTMLStatusFileName ),
HighPrecisionTimer ( bNUseDoubleSystemFrameSize ),
ServerListManager ( iPortNumber,
ServerListManager ( this,
iPortNumber,
strDirectoryAddress,
strServerListFileName,
strServerInfo,
strServerPublicIP,
strServerListFilter,
iNewMaxNumChan,
bNEnableIPv6,
&ConnLessProtocol ),
JamController ( this ),
bDisableRecording ( bDisableRecording ),
bAutoRunMinimized ( false ),
bDelayPan ( bNDelayPan ),
bEnableIPv6 ( bNEnableIPv6 ),
eLicenceType ( eNLicenceType ),
bDisconnectAllClientsOnQuit ( bNDisconnectAllClientsOnQuit ),
pSignalHandler ( CSignalHandler::getSingletonP() )
Expand Down
10 changes: 4 additions & 6 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class CServer : public QObject, public CServerSlots<MAX_NUM_CHANNELS>
const bool bNUseMultithreading,
const bool bDisableRecording,
const bool bNDelayPan,
const bool bNEnableIPv6,
const bool bNDisableIPv6,
const ELicenceType eNLicenceType );

virtual ~CServer();
Expand All @@ -125,8 +125,8 @@ class CServer : public QObject, public CServerSlots<MAX_NUM_CHANNELS>

void CreateCLServerListReqVerAndOSMes ( const CHostAddress& InetAddr ) { ConnLessProtocol.CreateCLReqVersionAndOSMes ( InetAddr ); }

// IPv6 Enabled
bool IsIPv6Enabled() { return bEnableIPv6; }
// IPv6 Available
bool IsIPv6Available() { return bIPv6Available; }

// GUI settings ------------------------------------------------------------
int GetClientNumAudioChannels ( const int iChanNum ) { return vecChannels[iChanNum].GetNumAudioChannels(); }
Expand Down Expand Up @@ -273,6 +273,7 @@ class CServer : public QObject, public CServerSlots<MAX_NUM_CHANNELS>
CVector<uint16_t> vecChannelLevels;

// actual working objects
bool bIPv6Available; // must be before Socket - passed by reference to Socket
CHighPrioSocket Socket;

// logging
Expand Down Expand Up @@ -300,9 +301,6 @@ class CServer : public QObject, public CServerSlots<MAX_NUM_CHANNELS>
// for delay panning
bool bDelayPan;

// enable IPv6
bool bEnableIPv6;

// messaging
QString strWelcomeMessage;
ELicenceType eLicenceType;
Expand Down
4 changes: 2 additions & 2 deletions src/serverdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,12 @@ CServerDlg::CServerDlg ( CServer* pNServP, CServerSettings* pNSetP, const bool b

// Don't use SRV resolution when resolving update servers.

if ( NetworkUtil::ParseNetworkAddressBare ( UPDATECHECK1_ADDRESS, UpdateServerHostAddress, pServer->IsIPv6Enabled() ) )
if ( NetworkUtil::ParseNetworkAddressBare ( UPDATECHECK1_ADDRESS, UpdateServerHostAddress, pServer->IsIPv6Available() ) )
{
pServer->CreateCLServerListReqVerAndOSMes ( UpdateServerHostAddress );
}

if ( NetworkUtil::ParseNetworkAddressBare ( UPDATECHECK2_ADDRESS, UpdateServerHostAddress, pServer->IsIPv6Enabled() ) )
if ( NetworkUtil::ParseNetworkAddressBare ( UPDATECHECK2_ADDRESS, UpdateServerHostAddress, pServer->IsIPv6Available() ) )
{
pServer->CreateCLServerListReqVerAndOSMes ( UpdateServerHostAddress );
}
Expand Down
Loading
Loading