If a 'Basic' mode connection fails, re-start spawned MPD instance (and remove any previous pid file).
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
9. When adding a podcast (or other track from an internet service), remove
|
||||
any new-lines from metadata.
|
||||
10. When configuring streams, clear list of providers before re-populating.
|
||||
11. If a 'Basic' mode connection fails, re-start spawned MPD instance (and
|
||||
remove any previous pid file).
|
||||
|
||||
2.0.1
|
||||
-----
|
||||
|
||||
@@ -434,13 +434,26 @@ MPDConnection::ConnectionReturn MPDConnection::connectToMPD()
|
||||
DBUG << "Something has gone wrong with sockets, so disconnect";
|
||||
disconnectFromMPD();
|
||||
}
|
||||
#ifdef ENABLE_SIMPLE_MPD_SUPPORT
|
||||
int maxConnAttempts=MPDUser::constName==details.name ? 2 : 1;
|
||||
#else
|
||||
int connAttempts=1;
|
||||
#endif
|
||||
ConnectionReturn status=Failed;
|
||||
if (Success==(status=connectToMPD(sock)) && Success==(status=connectToMPD(idleSocket, true))) {
|
||||
state=State_Connected;
|
||||
emit socketAddress(sock.address());
|
||||
} else {
|
||||
disconnectFromMPD();
|
||||
state=State_Disconnected;
|
||||
for (int connAttempt=0; connAttempt<maxConnAttempts; ++connAttempt) {
|
||||
if (Success==(status=connectToMPD(sock)) && Success==(status=connectToMPD(idleSocket, true))) {
|
||||
state=State_Connected;
|
||||
emit socketAddress(sock.address());
|
||||
} else {
|
||||
disconnectFromMPD();
|
||||
state=State_Disconnected;
|
||||
#ifdef ENABLE_SIMPLE_MPD_SUPPORT
|
||||
if (0==connAttempt && MPDUser::constName==details.name) {
|
||||
MPDUser::self()->stop();
|
||||
MPDUser::self()->start();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
connTimer->start(30000);
|
||||
return status;
|
||||
|
||||
@@ -362,5 +362,8 @@ bool MPDUser::controlMpd(bool stop)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stop && !pidFileName.isEmpty() && QFile::exists(pidFileName)) {
|
||||
QFile::remove(pidFileName);
|
||||
}
|
||||
return started;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user