Web UI shutdown fix.

This commit is contained in:
Christophe Dumez 2012-08-20 17:50:41 +03:00
commit 368ae43849

View file

@ -277,9 +277,20 @@ void HttpConnection::respond() {
} }
if (list[0] == "command") { if (list[0] == "command") {
const QString& command = list[1]; const QString& command = list[1];
if (command == "shutdown") {
qDebug() << "Shutdown request from Web UI";
// Special case handling for shutdown, we
// need to reply to the Web UI before
// actually shutting down.
m_generator.setStatusLine(200, "OK");
write();
// Exit application
qApp->exit();
} else {
respondCommand(command); respondCommand(command);
m_generator.setStatusLine(200, "OK"); m_generator.setStatusLine(200, "OK");
write(); write();
}
return; return;
} }
} }
@ -595,10 +606,6 @@ void HttpConnection::respondCommand(const QString& command) {
QBtSession::instance()->recheckTorrent(m_parser.post("hash")); QBtSession::instance()->recheckTorrent(m_parser.post("hash"));
return; return;
} }
if (command == "shutdown") {
qDebug() << "Shutdown request from Web UI";
qApp->exit();
}
} }
void HttpConnection::decreaseTorrentsPriority(const QStringList &hashes) { void HttpConnection::decreaseTorrentsPriority(const QStringList &hashes) {