refactor
This commit is contained in:
parent
ecde07e5a4
commit
590cbbe469
2 changed files with 13 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -20,6 +20,7 @@ class CMpdClient : public CThread
|
|||
private:
|
||||
bool OpenSocket();
|
||||
bool GetCurrentSong();
|
||||
void ClearCurrentSong();
|
||||
|
||||
int m_port;
|
||||
std::string m_address;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue