@@ -128,9 +128,11 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum,
128128 const QString& strServerPublicIP,
129129 const int iNumChannels,
130130 const bool bNEnableIPv6,
131+ const bool bNEnableTcp,
131132 CProtocol* pNConLProt ) :
132133 DirectoryType ( AT_NONE ),
133134 bEnableIPv6 ( bNEnableIPv6 ),
135+ bEnableTcp ( bNEnableTcp ),
134136 ServerListFileName ( strServerListFileName ),
135137 strDirectoryAddress ( " " ),
136138 bIsDirectory ( false ),
@@ -709,7 +711,9 @@ void CServerListManager::RetrieveAll ( const CHostAddress& InetAddr, CTcpConnect
709711 }
710712
711713 // do not send a "ping" to a server local to the directory (no need)
712- if ( !serverIsInternal )
714+ // also only do so if processing a request over UDP, not TCP,
715+ // as the client will always try UDP before TCP.
716+ if ( !serverIsInternal && !pTcpConnection )
713717 {
714718 // create "send empty message" for all other registered servers
715719 // this causes the server (vecServerInfo[iIdx].HostAddr)
@@ -728,6 +732,12 @@ void CServerListManager::RetrieveAll ( const CHostAddress& InetAddr, CTcpConnect
728732 pConnLessProtocol->CreateCLRedServerListMes ( InetAddr, vecServerInfo );
729733 }
730734 pConnLessProtocol->CreateCLServerListMes ( InetAddr, vecServerInfo, pTcpConnection );
735+
736+ // if TCP is enabled but this request is on UDP, say TCP is supported
737+ if ( bEnableTcp && !pTcpConnection )
738+ {
739+ pConnLessProtocol->CreateCLTcpSupportedMes ( InetAddr );
740+ }
731741 }
732742}
733743
0 commit comments