Implement new GeoIPManager class.

This commit is contained in:
Vladimir Golovnev (Glassez) 2015-05-18 17:02:48 +03:00
parent c702a7e426
commit 79976fbfce
28 changed files with 1228 additions and 401 deletions

View file

@ -63,7 +63,7 @@ using namespace BitTorrent;
//#include <libtorrent/extensions/metadata_transfer.hpp>
#ifndef DISABLE_COUNTRIES_RESOLUTION
#include "geoipmanager.h"
#include "core/net/geoipmanager.h"
#endif
#include "core/utils/misc.h"
@ -141,10 +141,6 @@ Session::Session(QObject *parent)
, m_globalMaxRatio(-1)
, m_numResumeData(0)
, m_extraLimit(0)
#ifndef DISABLE_COUNTRIES_RESOLUTION
, m_geoipDBLoaded(false)
, m_resolveCountries(false)
#endif
, m_appendLabelToSavePath(false)
, m_appendExtension(false)
, m_refreshInterval(0)
@ -252,13 +248,6 @@ bool Session::useAppendLabelToSavePath() const
return m_appendLabelToSavePath;
}
#ifndef DISABLE_COUNTRIES_RESOLUTION
bool Session::isResolveCountriesEnabled() const
{
return m_resolveCountries;
}
#endif
QString Session::defaultSavePath() const
{
return m_defaultSavePath;
@ -577,25 +566,6 @@ void Session::configure()
delete m_bwScheduler;
}
#ifndef DISABLE_COUNTRIES_RESOLUTION
// Resolve countries
qDebug("Loading country resolution settings");
const bool new_resolv_countries = pref->resolvePeerCountries();
if (m_resolveCountries != new_resolv_countries) {
qDebug("in country resolution settings");
m_resolveCountries = new_resolv_countries;
if (m_resolveCountries && !m_geoipDBLoaded) {
qDebug("Loading geoip database");
GeoIPManager::loadDatabase(m_nativeSession);
m_geoipDBLoaded = true;
}
// Update torrent handles
foreach (TorrentHandlePrivate *const torrent, m_torrents)
torrent->handleResolveCountriesToggled();
}
#endif
Logger* const logger = Logger::instance();
// * Session settings