Skip to content
Open
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
18 changes: 16 additions & 2 deletions src/serverlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,13 +969,27 @@ 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
// 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, 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 );
#else
const bool bDirectoryAddressValid = NetworkUtil().ParseNetworkAddress ( strNetworkAddress, DirectoryAddress, false );
#endif

// lock the mutex again now that the address has been resolved.
locker.relock();

if ( bIsRegister )
{
Expand Down
Loading