mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 14:46:33 +02:00
Make less usage of QHostAddress when dealing with DNS records.
This commit is contained in:
@@ -142,7 +142,7 @@ void TomahawkXmppMessageFactory::serialize(Payload *extension, QXmlStreamWriter
|
|||||||
if ( info.isVisible() )
|
if ( info.isVisible() )
|
||||||
{
|
{
|
||||||
QHostAddress ha = QHostAddress( info.host() );
|
QHostAddress ha = QHostAddress( info.host() );
|
||||||
if ( ( Servent::isValidExternalIP( ha ) && ha.protocol() == QAbstractSocket::IPv4Protocol ) || ( ha.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol ) )
|
if ( ( Servent::isValidExternalIP( ha ) && ha.protocol() == QAbstractSocket::IPv4Protocol ) || ( ha.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol ) || ( ha.isNull() && !info.host().isEmpty() ) )
|
||||||
{
|
{
|
||||||
// For comapability reasons, this shall be put as the last candidate (this is the IP/host that would have been sent in previous versions)
|
// For comapability reasons, this shall be put as the last candidate (this is the IP/host that would have been sent in previous versions)
|
||||||
lastInfo = QSharedPointer<SipInfo>( new SipInfo( info ) );
|
lastInfo = QSharedPointer<SipInfo>( new SipInfo( info ) );
|
||||||
|
@@ -398,7 +398,7 @@ Servent::getSipInfoForOldVersions( const QList<SipInfo>& sipInfos ) const
|
|||||||
foreach ( SipInfo _info, sipInfos )
|
foreach ( SipInfo _info, sipInfos )
|
||||||
{
|
{
|
||||||
QHostAddress ha = QHostAddress( _info.host() );
|
QHostAddress ha = QHostAddress( _info.host() );
|
||||||
if ( ( Servent::isValidExternalIP( ha ) && ha.protocol() == QAbstractSocket::IPv4Protocol ) || ( ha.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol ) )
|
if ( ( Servent::isValidExternalIP( ha ) && ha.protocol() == QAbstractSocket::IPv4Protocol ) || ( ha.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol ) || ( ha.isNull() && !_info.host().isEmpty() ))
|
||||||
{
|
{
|
||||||
info = _info;
|
info = _info;
|
||||||
break;
|
break;
|
||||||
@@ -931,7 +931,7 @@ Servent::connectToPeer(const peerinfo_ptr& peerInfo, const QList<SipInfo>& sipIn
|
|||||||
// Check that we are not connecting to ourselves
|
// Check that we are not connecting to ourselves
|
||||||
foreach( QHostAddress ha, m_externalAddresses )
|
foreach( QHostAddress ha, m_externalAddresses )
|
||||||
{
|
{
|
||||||
if ( QHostAddress( info.host() ) == ha)
|
if ( info.host() == ha.toString() )
|
||||||
{
|
{
|
||||||
peerInfoDebug(peerInfo) << Q_FUNC_INFO << "Tomahawk won't try to connect to" << info.host() << ":" << info.port() << ": same IP as ourselves.";
|
peerInfoDebug(peerInfo) << Q_FUNC_INFO << "Tomahawk won't try to connect to" << info.host() << ":" << info.port() << ": same IP as ourselves.";
|
||||||
connectToPeer( peerInfo, sipInfo, conn );
|
connectToPeer( peerInfo, sipInfo, conn );
|
||||||
|
Reference in New Issue
Block a user