This commit is contained in:
Bob van Loosen 2012-12-20 19:28:27 +01:00
parent ecde07e5a4
commit 590cbbe469
2 changed files with 13 additions and 2 deletions

View file

@ -27,14 +27,14 @@ void CMpdClient::Process()
{
if (!OpenSocket())
{
m_currentsong.clear();
ClearCurrentSong();
continue;
}
}
if (!GetCurrentSong())
{
m_currentsong.clear();
ClearCurrentSong();
m_socket.Close();
}
@ -120,6 +120,16 @@ bool CMpdClient::GetCurrentSong()
return false;
}
void CMpdClient::ClearCurrentSong()
{
CLock lock(m_condition);
if (!m_currentsong.empty())
{
m_currentsong.clear();
m_songchanged = true;
}
}
bool CMpdClient::CurrentSong(std::string& song)
{
CLock lock(m_condition);

View file

@ -20,6 +20,7 @@ class CMpdClient : public CThread
private:
bool OpenSocket();
bool GetCurrentSong();
void ClearCurrentSong();
int m_port;
std::string m_address;