Only start internal HTTP server when required, and stop 1 second after last Cantata stream is removed.

BUG: 369
This commit is contained in:
craig.p.drummond
2014-01-02 19:05:06 +00:00
committed by craig.p.drummond
parent 16b3ed8e25
commit 3a07ab4e6d
9 changed files with 153 additions and 77 deletions

View File

@@ -259,6 +259,8 @@ HttpSocket::HttpSocket(const QString &iface, quint16 port)
ifaceAddress=QLatin1String("127.0.0.1");
}
DBUG << isListening() << ifaceAddress << serverPort();
connect(MPDConnection::self(), SIGNAL(socketAddress(QString)), this, SLOT(mpdAddress(QString)));
connect(MPDConnection::self(), SIGNAL(cantataStreams(QList<Song>,bool)), this, SLOT(cantataStreams(QList<Song>,bool)));
connect(MPDConnection::self(), SIGNAL(cantataStreams(QStringList)), this, SLOT(cantataStreams(QStringList)));
@@ -293,7 +295,12 @@ bool HttpSocket::openPort(const QHostAddress &a, quint16 p)
void HttpSocket::terminate()
{
if (terminated) {
return;
}
DBUG;
terminated=true;
close();
deleteLater();
}