init player when receiving a header message

This commit is contained in:
badaix 2016-01-31 23:56:28 +01:00
parent 94944681c2
commit 7b1323646f
12 changed files with 149 additions and 117 deletions

View file

@ -113,9 +113,12 @@ void ControlSession::reader()
while (active_)
{
asio::streambuf response;
asio::read_until(*socket_, response, "\r\n");
asio::read_until(*socket_, response, "\n");
std::string s((istreambuf_iterator<char>(&response)), istreambuf_iterator<char>());
s.resize(s.length() - 2);
size_t len = s.length() - 1;
if ((len >= 2) && s[len-2] == '\r')
--len;
s.resize(len);
if (messageReceiver_ != NULL)
messageReceiver_->onMessageReceived(this, s);