Browse Source

Merge pull request #12942 from Chocobo1/cacheCountry

Cache country lookup result in PeerInfo class
adaptive-webui-19844
Mike Tzou 5 years ago committed by GitHub
parent
commit
9d135441db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/base/bittorrent/peerinfo.cpp
  2. 4
      src/base/bittorrent/peerinfo.h

4
src/base/bittorrent/peerinfo.cpp

@ -64,7 +64,9 @@ bool PeerInfo::fromLSD() const @@ -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

4
src/base/bittorrent/peerinfo.h

@ -102,6 +102,10 @@ namespace BitTorrent @@ -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
};
}

Loading…
Cancel
Save