From de32e730d80928f5fb02921f32ce8b036712a939 Mon Sep 17 00:00:00 2001 From: Rick Dicaire Date: Wed, 5 Nov 2025 18:21:57 -0500 Subject: [PATCH 1/3] Provides SRV support for --directoryaddress --- src/serverlist.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/serverlist.cpp b/src/serverlist.cpp index c1015256b5..10378f6e5c 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -974,8 +974,13 @@ void CServerListManager::SetRegistered ( const bool bIsRegister ) // it is an URL of a dynamic IP address, the IP address might have // changed in the meanwhile. // Allow IPv4 only for communicating with Directories - const QString strNetworkAddress = NetworkUtil::GetDirectoryAddress ( DirectoryType, strDirectoryAddress ); - const bool bDirectoryAddressValid = NetworkUtil().ParseNetworkAddress ( strNetworkAddress, DirectoryAddress, false ); + // Use SRV DNS discovery for directory connections + const QString strNetworkAddress = NetworkUtil::GetDirectoryAddress ( DirectoryType, strDirectoryAddress ); +#ifndef CLIENT_NO_SRV_CONNECT + const bool bDirectoryAddressValid = NetworkUtil().ParseNetworkAddressWithSrvDiscovery ( strNetworkAddress, DirectoryAddress, false ); +#else + const bool bDirectoryAddressValid = NetworkUtil().ParseNetworkAddress ( strNetworkAddress, DirectoryAddress, false ); +#endif if ( bIsRegister ) { From 21024b48f4090b0eb3f508605b64ea7f41ea8457 Mon Sep 17 00:00:00 2001 From: Rick Dicaire Date: Wed, 5 Nov 2025 19:26:58 -0500 Subject: [PATCH 2/3] Update comment for clarity --- src/serverlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 10378f6e5c..9bce4054ea 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -974,7 +974,7 @@ void CServerListManager::SetRegistered ( const bool bIsRegister ) // it is an URL of a dynamic IP address, the IP address might have // changed in the meanwhile. // Allow IPv4 only for communicating with Directories - // Use SRV DNS discovery for directory connections + // Use SRV DNS discovery for directory connections, fallback to A/AAAA if none. const QString strNetworkAddress = NetworkUtil::GetDirectoryAddress ( DirectoryType, strDirectoryAddress ); #ifndef CLIENT_NO_SRV_CONNECT const bool bDirectoryAddressValid = NetworkUtil().ParseNetworkAddressWithSrvDiscovery ( strNetworkAddress, DirectoryAddress, false ); From d2c6b0bb111415858095197fa4fe07c32ab09a03 Mon Sep 17 00:00:00 2001 From: Tony Mountifield Date: Tue, 13 Jan 2026 17:42:21 +0000 Subject: [PATCH 3/3] Unlock mutex before resolving SRV --- src/serverlist.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 9bce4054ea..70bccf3956 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -969,6 +969,12 @@ void CServerListManager::SetRegistered ( const bool bIsRegister ) return; } + // It is very important to unlock the Mutex before doing address resolution, + // so that the event loop can run and any other timers that need the mutex + // can obtain it. Otherwise there is the possibility of deadlock when doing + // the SRV lookup, if another timer fires that needs the same mutex. + locker.unlock(); + // get the correct directory address // Note that we always have to parse the server address again since if // it is an URL of a dynamic IP address, the IP address might have @@ -982,6 +988,9 @@ void CServerListManager::SetRegistered ( const bool bIsRegister ) const bool bDirectoryAddressValid = NetworkUtil().ParseNetworkAddress ( strNetworkAddress, DirectoryAddress, false ); #endif + // lock the mutex again now that the address has been resolved. + locker.relock(); + if ( bIsRegister ) { if ( bDirectoryAddressValid )