media library/tag editor: block idle while doing hierarchical searches

idle should be blocked in such cases since it would be enabled and
disabled a few times by each mpd command, which makes no sense and
slows down the whole process.
This commit is contained in:
Andrzej Rybczak
2010-06-17 16:41:49 +02:00
parent 10cea746e9
commit 9c02bbf596
4 changed files with 17 additions and 3 deletions

View File

@@ -142,18 +142,21 @@ void MPD::Connection::SetErrorHandler(ErrorHandler handler, void *data)
void MPD::Connection::GoIdle()
{
if (supportsIdle && !isIdle && mpd_send_idle(itsConnection))
if (supportsIdle && !itsIdleBlocked && !isIdle && mpd_send_idle(itsConnection))
isIdle = 1;
}
int MPD::Connection::GoBusy()
{
int flags = 0;
if (isIdle && mpd_send_noidle(itsConnection))
{
isIdle = 0;
return mpd_recv_idle(itsConnection, 1);
if (hasData)
flags = mpd_recv_idle(itsConnection, 1);
mpd_response_finish(itsConnection);
}
return 0;
return flags;
}
void MPD::Connection::UpdateStatus()