- Fixed compiling with latest libtorrent svn/trunk

- Added some errors messages if fastresume fails
This commit is contained in:
Christophe Dumez 2007-05-04 13:58:07 +00:00
commit 1c5262b1ed
4 changed files with 49 additions and 10 deletions

View file

@ -1168,7 +1168,10 @@ void GUI::configureSession(bool deleteOptions){
qDebug("Configuring session");
QPair<int, int> limits;
unsigned short old_listenPort, new_listenPort;
session_settings proxySettings;
#ifdef V_0_13
proxy_settings proxySettings;
#endif
session_settings sessionSettings;
// Configure session regarding options
BTSession.setDefaultSavePath(options->getSavePath());
old_listenPort = BTSession.getListenPort();
@ -1222,15 +1225,33 @@ void GUI::configureSession(bool deleteOptions){
}
// Apply Proxy settings
if(options->isProxyEnabled()){
proxySettings.proxy_ip = options->getProxyIp().toStdString();
proxySettings.proxy_port = options->getProxyPort();
#ifndef V_0_13
sessionSettings.proxy_ip = options->getProxyIp().toStdString();
sessionSettings.proxy_port = options->getProxyPort();
#endif
#ifdef V_0_13
proxySettings.hostname = options->getProxyIp().toStdString();
proxySettings.port = options->getProxyPort();
proxySettings.type = proxy_settings::http;
#endif
if(options->isProxyAuthEnabled()){
proxySettings.proxy_login = options->getProxyUsername().toStdString();
proxySettings.proxy_password = options->getProxyPassword().toStdString();
#ifndef V_0_13
sessionSettings.proxy_login = options->getProxyUsername().toStdString();
sessionSettings.proxy_password = options->getProxyPassword().toStdString();
#endif
#ifdef V_0_13
proxySettings.username = options->getProxyUsername().toStdString();
proxySettings.password = options->getProxyPassword().toStdString();
proxySettings.type = proxy_settings::http_pw;
#endif
}
}
proxySettings.user_agent = "qBittorrent "VERSION;
BTSession.setSessionSettings(proxySettings);
#ifdef V_0_13
BTSession.setProxySettings(proxySettings);
#endif
sessionSettings.user_agent = "qBittorrent "VERSION;
BTSession.setSessionSettings(sessionSettings);
// Scan dir stuff
if(options->getScanDir().isNull()){
BTSession.disableDirectoryScanning();

View file

@ -229,8 +229,12 @@ void bittorrent::addTorrent(const QString& path, bool fromScanDir, const QString
resume_file.unsetf(std::ios_base::skipws);
resume_data = bdecode(std::istream_iterator<char>(resume_file), std::istream_iterator<char>());
fastResume=true;
}catch (invalid_encoding&) {}
catch (fs::filesystem_error&) {}
}catch (invalid_encoding&) {
std::cerr << "Encoding error while loading fastsume data for " << t.name().c_str() << '\n';
}
catch (fs::filesystem_error&) {
std::cerr << "Filesystem error while loading fastsume data for " << t.name().c_str() << '\n';
}
}
QString savePath = getSavePath(hash);
// Adding files to bittorrent session
@ -627,6 +631,14 @@ void bittorrent::setSessionSettings(session_settings sessionSettings){
s->set_settings(sessionSettings);
}
#ifdef V_0_13
void bittorrent::setProxySettings(proxy_settings proxySettings){
s->set_peer_proxy(proxySettings);
s->set_web_seed_proxy(proxySettings);
s->set_tracker_proxy(proxySettings);
}
#endif
// Read alerts sent by the bittorrent session
void bittorrent::readAlerts(){
// look at session alerts and display some infos
@ -651,6 +663,9 @@ void bittorrent::readAlerts(){
emit trackerAuthenticationRequired(p->handle);
}
}
else if (fastresume_rejected_alert* p = dynamic_cast<fastresume_rejected_alert*>(a.get())) {
std::cerr << "Error while using fastresume data for " << p->handle.name() << ", msg: " << p->msg() << '\n';
}
a = s->pop_alert();
}
}

View file

@ -121,6 +121,9 @@ class bittorrent : public QObject{
void setGlobalRatio(float ratio);
void setDHTPort(int dht_port);
void setSessionSettings(session_settings sessionSettings);
#ifdef V_0_13
void setProxySettings(proxy_settings proxySettings);
#endif
void setDefaultSavePath(const QString& savepath);
protected slots:

View file

@ -11,7 +11,7 @@ TARGET = qbittorrent
CONFIG += qt thread x11
# Update this VERSION for each release
DEFINES += VERSION=\\\"v0.9.3rc1\\\"
DEFINES += VERSION=\\\"v0.9.3rc2\\\"
DEFINES += VERSION_MAJOR=0
DEFINES += VERSION_MINOR=9
DEFINES += VERSION_BUGFIX=3