1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-23 13:04:23 +00:00

Cache country lookup result in PeerInfo class

The country lookup happens quite often when "Resolve peer countries"
option is enabled.
This commit is contained in:
Chocobo1 2020-05-29 13:48:43 +08:00
parent c003a12f1f
commit 472dd96716
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
2 changed files with 7 additions and 1 deletions

View File

@ -64,7 +64,9 @@ bool PeerInfo::fromLSD() const
#ifndef DISABLE_COUNTRIES_RESOLUTION
QString PeerInfo::country() const
{
return Net::GeoIPManager::instance()->lookup(address().ip);
if (m_country.isEmpty())
m_country = Net::GeoIPManager::instance()->lookup(address().ip);
return m_country;
}
#endif

View File

@ -102,6 +102,10 @@ namespace BitTorrent
qreal m_relevance = 0;
QString m_flags;
QString m_flagsDescription;
#ifndef DISABLE_COUNTRIES_RESOLUTION
mutable QString m_country;
#endif
};
}