From 1c5262b1ed5992fa083bed25a535526e8d9cea0b Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 4 May 2007 13:58:07 +0000 Subject: [PATCH] - Fixed compiling with latest libtorrent svn/trunk - Added some errors messages if fastresume fails --- src/GUI.cpp | 35 ++++++++++++++++++++++++++++------- src/bittorrent.cpp | 19 +++++++++++++++++-- src/bittorrent.h | 3 +++ src/src.pro | 2 +- 4 files changed, 49 insertions(+), 10 deletions(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index 5be94e17c..e2da27e83 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -1168,7 +1168,10 @@ void GUI::configureSession(bool deleteOptions){ qDebug("Configuring session"); QPair 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(); diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 30f5b0b49..7f71aebd6 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -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(resume_file), std::istream_iterator()); 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(a.get())) { + std::cerr << "Error while using fastresume data for " << p->handle.name() << ", msg: " << p->msg() << '\n'; + } a = s->pop_alert(); } } diff --git a/src/bittorrent.h b/src/bittorrent.h index cbce8d289..501c97294 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -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: diff --git a/src/src.pro b/src/src.pro index 40196450a..b268f4d92 100644 --- a/src/src.pro +++ b/src/src.pro @@ -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