mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
Fix initialization problem with some private trackers
This commit is contained in:
parent
da32321f10
commit
3154461f28
2 changed files with 26 additions and 13 deletions
|
@ -138,12 +138,6 @@ QBtSession::QBtSession()
|
||||||
timerAlerts = new QTimer(this);
|
timerAlerts = new QTimer(this);
|
||||||
connect(timerAlerts, SIGNAL(timeout()), SLOT(readAlerts()));
|
connect(timerAlerts, SIGNAL(timeout()), SLOT(readAlerts()));
|
||||||
timerAlerts->start(1000);
|
timerAlerts->start(1000);
|
||||||
connect(&resumeDataTimer, SIGNAL(timeout()), SLOT(saveTempFastResumeData()));
|
|
||||||
resumeDataTimer.start(180000); // 3min
|
|
||||||
// To download from urls
|
|
||||||
downloader = new DownloadThread(this);
|
|
||||||
connect(downloader, SIGNAL(downloadFinished(QString, QString)), SLOT(processDownloadedFile(QString, QString)));
|
|
||||||
connect(downloader, SIGNAL(downloadFailure(QString, QString)), SLOT(handleDownloadFailure(QString, QString)));
|
|
||||||
appendLabelToSavePath = pref.appendTorrentLabel();
|
appendLabelToSavePath = pref.appendTorrentLabel();
|
||||||
#if LIBTORRENT_VERSION_MINOR > 14
|
#if LIBTORRENT_VERSION_MINOR > 14
|
||||||
appendqBExtension = pref.useIncompleteFilesExtension();
|
appendqBExtension = pref.useIncompleteFilesExtension();
|
||||||
|
@ -154,6 +148,13 @@ QBtSession::QBtSession()
|
||||||
// Torrent speed monitor
|
// Torrent speed monitor
|
||||||
m_speedMonitor = new TorrentSpeedMonitor(this);
|
m_speedMonitor = new TorrentSpeedMonitor(this);
|
||||||
m_speedMonitor->start();
|
m_speedMonitor->start();
|
||||||
|
// To download from urls
|
||||||
|
downloader = new DownloadThread(this);
|
||||||
|
connect(downloader, SIGNAL(downloadFinished(QString, QString)), SLOT(processDownloadedFile(QString, QString)));
|
||||||
|
connect(downloader, SIGNAL(downloadFailure(QString, QString)), SLOT(handleDownloadFailure(QString, QString)));
|
||||||
|
// Regular saving of fastresume data
|
||||||
|
connect(&resumeDataTimer, SIGNAL(timeout()), SLOT(saveTempFastResumeData()));
|
||||||
|
resumeDataTimer.start(170000); // 3min
|
||||||
qDebug("* BTSession constructed");
|
qDebug("* BTSession constructed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,6 +276,14 @@ void QBtSession::setQueueingEnabled(bool enable) {
|
||||||
void QBtSession::configureSession() {
|
void QBtSession::configureSession() {
|
||||||
qDebug("Configuring session");
|
qDebug("Configuring session");
|
||||||
const Preferences pref;
|
const Preferences pref;
|
||||||
|
// * Ports binding
|
||||||
|
const unsigned short old_listenPort = getListenPort();
|
||||||
|
const unsigned short new_listenPort = pref.getSessionPort();
|
||||||
|
if(old_listenPort != new_listenPort) {
|
||||||
|
setListeningPort(new_listenPort);
|
||||||
|
addConsoleMessage(tr("qBittorrent is bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg(QString::number(new_listenPort)));
|
||||||
|
}
|
||||||
|
|
||||||
// Downloads
|
// Downloads
|
||||||
// * Save path
|
// * Save path
|
||||||
defaultSavePath = pref.getSavePath();
|
defaultSavePath = pref.getSavePath();
|
||||||
|
@ -311,13 +320,6 @@ void QBtSession::configureSession() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Connection
|
// Connection
|
||||||
// * Ports binding
|
|
||||||
const unsigned short old_listenPort = getListenPort();
|
|
||||||
const unsigned short new_listenPort = pref.getSessionPort();
|
|
||||||
if(old_listenPort != new_listenPort) {
|
|
||||||
setListeningPort(new_listenPort);
|
|
||||||
addConsoleMessage(tr("qBittorrent is bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg(QString::number(new_listenPort)));
|
|
||||||
}
|
|
||||||
// * Global download limit
|
// * Global download limit
|
||||||
const bool alternative_speeds = pref.isAltBandwidthEnabled();
|
const bool alternative_speeds = pref.isAltBandwidthEnabled();
|
||||||
int down_limit;
|
int down_limit;
|
||||||
|
@ -2413,6 +2415,16 @@ void QBtSession::readAlerts() {
|
||||||
addConsoleMessage(tr("Url seed lookup failed for url: %1, message: %2").arg(misc::toQString(p->url)).arg(misc::toQString(p->message())), QString::fromUtf8("red"));
|
addConsoleMessage(tr("Url seed lookup failed for url: %1, message: %2").arg(misc::toQString(p->url)).arg(misc::toQString(p->message())), QString::fromUtf8("red"));
|
||||||
//emit urlSeedProblem(QString::fromUtf8(p->url.c_str()), QString::fromUtf8(p->msg().c_str()));
|
//emit urlSeedProblem(QString::fromUtf8(p->url.c_str()), QString::fromUtf8(p->msg().c_str()));
|
||||||
}
|
}
|
||||||
|
else if (listen_succeeded_alert *p = dynamic_cast<listen_succeeded_alert*>(a.get())) {
|
||||||
|
qDebug() << "Sucessfully listening on" << p->endpoint.address().to_string().c_str() << "/" << p->endpoint.port();
|
||||||
|
// Force reannounce on all torrents because some trackers blacklist some ports
|
||||||
|
std::vector<torrent_handle> torrents = s->get_torrents();
|
||||||
|
std::vector<torrent_handle>::iterator it;
|
||||||
|
for(it = torrents.begin(); it != torrents.end(); it++) {
|
||||||
|
it->force_reannounce();
|
||||||
|
}
|
||||||
|
emit listenSucceeded();
|
||||||
|
}
|
||||||
else if (torrent_checked_alert* p = dynamic_cast<torrent_checked_alert*>(a.get())) {
|
else if (torrent_checked_alert* p = dynamic_cast<torrent_checked_alert*>(a.get())) {
|
||||||
QTorrentHandle h(p->handle);
|
QTorrentHandle h(p->handle);
|
||||||
if(h.is_valid()){
|
if(h.is_valid()){
|
||||||
|
|
|
@ -211,6 +211,7 @@ signals:
|
||||||
void alternativeSpeedsModeChanged(bool alternative);
|
void alternativeSpeedsModeChanged(bool alternative);
|
||||||
void recursiveTorrentDownloadPossible(const QTorrentHandle &h);
|
void recursiveTorrentDownloadPossible(const QTorrentHandle &h);
|
||||||
void ipFilterParsed(bool error, int ruleCount);
|
void ipFilterParsed(bool error, int ruleCount);
|
||||||
|
void listenSucceeded();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if LIBTORRENT_VERSION_MINOR < 15
|
#if LIBTORRENT_VERSION_MINOR < 15
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue