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())
|
if (!OpenSocket())
|
||||||
{
|
{
|
||||||
m_currentsong.clear();
|
ClearCurrentSong();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GetCurrentSong())
|
if (!GetCurrentSong())
|
||||||
{
|
{
|
||||||
m_currentsong.clear();
|
ClearCurrentSong();
|
||||||
m_socket.Close();
|
m_socket.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +120,16 @@ bool CMpdClient::GetCurrentSong()
|
||||||
return false;
|
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)
|
bool CMpdClient::CurrentSong(std::string& song)
|
||||||
{
|
{
|
||||||
CLock lock(m_condition);
|
CLock lock(m_condition);
|
||||||
|
|
|
@ -20,6 +20,7 @@ class CMpdClient : public CThread
|
||||||
private:
|
private:
|
||||||
bool OpenSocket();
|
bool OpenSocket();
|
||||||
bool GetCurrentSong();
|
bool GetCurrentSong();
|
||||||
|
void ClearCurrentSong();
|
||||||
|
|
||||||
int m_port;
|
int m_port;
|
||||||
std::string m_address;
|
std::string m_address;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue