mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
Fix qBtSession important initialization problem
Fix qBittorrent shutdown problem (closes #682576)
This commit is contained in:
parent
cc1b812232
commit
5d86930c80
3 changed files with 29 additions and 28 deletions
|
@ -146,7 +146,7 @@ QBtSession::QBtSession()
|
||||||
#endif
|
#endif
|
||||||
connect(m_scanFolders, SIGNAL(torrentsAdded(QStringList&)), this, SLOT(addTorrentsFromScanFolder(QStringList&)));
|
connect(m_scanFolders, SIGNAL(torrentsAdded(QStringList&)), this, SLOT(addTorrentsFromScanFolder(QStringList&)));
|
||||||
// Apply user settings to Bittorrent session
|
// Apply user settings to Bittorrent session
|
||||||
QTimer::singleShot(0, this, SLOT(configureSession()));
|
configureSession();
|
||||||
qDebug("* BTSession constructed");
|
qDebug("* BTSession constructed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,14 +499,8 @@ void QBtSession::configureSession() {
|
||||||
disableIPFilter();
|
disableIPFilter();
|
||||||
}
|
}
|
||||||
// Update Web UI
|
// Update Web UI
|
||||||
if (pref.isWebUiEnabled()) {
|
// Use a QTimer because the function can be called from qBtSession constructor
|
||||||
const quint16 port = pref.getWebUiPort();
|
QTimer::singleShot(0, this, SLOT(initWebUi()));
|
||||||
const QString username = pref.getWebUiUsername();
|
|
||||||
const QString password = pref.getWebUiPassword();
|
|
||||||
initWebUi(username, password, port);
|
|
||||||
} else if(httpServer) {
|
|
||||||
delete httpServer;
|
|
||||||
}
|
|
||||||
// * Proxy settings
|
// * Proxy settings
|
||||||
proxy_settings proxySettings;
|
proxy_settings proxySettings;
|
||||||
if(pref.isProxyEnabled()) {
|
if(pref.isProxyEnabled()) {
|
||||||
|
@ -563,24 +557,31 @@ void QBtSession::configureSession() {
|
||||||
qDebug("Session configured");
|
qDebug("Session configured");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QBtSession::initWebUi(QString username, QString password, int port) {
|
void QBtSession::initWebUi() {
|
||||||
if(httpServer) {
|
Preferences pref;
|
||||||
if(httpServer->serverPort() != port) {
|
if (pref.isWebUiEnabled()) {
|
||||||
httpServer->close();
|
const quint16 port = pref.getWebUiPort();
|
||||||
|
const QString username = pref.getWebUiUsername();
|
||||||
|
const QString password = pref.getWebUiPassword();
|
||||||
|
|
||||||
|
if(httpServer) {
|
||||||
|
if(httpServer->serverPort() != port) {
|
||||||
|
httpServer->close();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
httpServer = new HttpServer(3000, this);
|
||||||
}
|
}
|
||||||
} else {
|
httpServer->setAuthorization(username, password);
|
||||||
httpServer = new HttpServer(3000, this);
|
if(!httpServer->isListening()) {
|
||||||
|
bool success = httpServer->listen(QHostAddress::Any, port);
|
||||||
|
if (success)
|
||||||
|
addConsoleMessage(tr("The Web UI is listening on port %1").arg(port));
|
||||||
|
else
|
||||||
|
addConsoleMessage(tr("Web User Interface Error - Unable to bind Web UI to port %1").arg(port), "red");
|
||||||
|
}
|
||||||
|
} else if(httpServer) {
|
||||||
|
delete httpServer;
|
||||||
}
|
}
|
||||||
httpServer->setAuthorization(username, password);
|
|
||||||
bool success = true;
|
|
||||||
if(!httpServer->isListening()) {
|
|
||||||
success = httpServer->listen(QHostAddress::Any, port);
|
|
||||||
if (success)
|
|
||||||
addConsoleMessage(tr("The Web UI is listening on port %1").arg(port));
|
|
||||||
else
|
|
||||||
addConsoleMessage(tr("Web User Interface Error - Unable to bind Web UI to port %1").arg(port), "red");
|
|
||||||
}
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QBtSession::useAlternativeSpeedsLimit(bool alternative) {
|
void QBtSession::useAlternativeSpeedsLimit(bool alternative) {
|
||||||
|
|
|
@ -163,7 +163,6 @@ public slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString getSavePath(QString hash, bool fromScanDir = false, QString filePath = QString::null, QString root_folder=QString::null);
|
QString getSavePath(QString hash, bool fromScanDir = false, QString filePath = QString::null, QString root_folder=QString::null);
|
||||||
bool initWebUi(QString username, QString password, int port);
|
|
||||||
bool loadFastResumeData(QString hash, std::vector<char> &buf);
|
bool loadFastResumeData(QString hash, std::vector<char> &buf);
|
||||||
void loadTorrentSettings(QTorrentHandle h);
|
void loadTorrentSettings(QTorrentHandle h);
|
||||||
void loadTorrentTempData(QTorrentHandle h, QString savePath, bool magnet);
|
void loadTorrentTempData(QTorrentHandle h, QString savePath, bool magnet);
|
||||||
|
@ -181,6 +180,7 @@ protected slots:
|
||||||
void cleanUpAutoRunProcess(int);
|
void cleanUpAutoRunProcess(int);
|
||||||
void mergeTorrents(QTorrentHandle h_ex, boost::intrusive_ptr<libtorrent::torrent_info> t);
|
void mergeTorrents(QTorrentHandle h_ex, boost::intrusive_ptr<libtorrent::torrent_info> t);
|
||||||
void exportTorrentFile(QTorrentHandle h);
|
void exportTorrentFile(QTorrentHandle h);
|
||||||
|
void initWebUi();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void addedTorrent(const QTorrentHandle& h);
|
void addedTorrent(const QTorrentHandle& h);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
os2 {
|
os2 {
|
||||||
DEFINES += VERSION=\'\"v2.5.0rc3\"\'
|
DEFINES += VERSION=\'\"v2.5.0rc4\"\'
|
||||||
} else {
|
} else {
|
||||||
DEFINES += VERSION=\\\"v2.5.0rc3\\\"
|
DEFINES += VERSION=\\\"v2.5.0rc4\\\"
|
||||||
}
|
}
|
||||||
DEFINES += VERSION_MAJOR=2
|
DEFINES += VERSION_MAJOR=2
|
||||||
DEFINES += VERSION_MINOR=5
|
DEFINES += VERSION_MINOR=5
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue