mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-19 03:56:14 +02:00
merge socket and client connection
git-svn-id: svn://elaine/murooma/trunk@275 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
3dbbf8e3e5
commit
d215580afe
10 changed files with 69 additions and 239 deletions
|
@ -25,21 +25,13 @@ void ServerSession::start()
|
|||
|
||||
void ServerSession::socketRead(void* _to, size_t _bytes)
|
||||
{
|
||||
// std::unique_lock<std::mutex> mlock(mutex_);
|
||||
size_t toRead = _bytes;
|
||||
size_t len = 0;
|
||||
size_t read = 0;
|
||||
do
|
||||
{
|
||||
// cout << "/";
|
||||
// cout.flush();
|
||||
boost::system::error_code error;
|
||||
len += socket->read_some(boost::asio::buffer((char*)_to + len, toRead), error);
|
||||
//cout << "len: " << len << ", error: " << error << endl;
|
||||
toRead = _bytes - len;
|
||||
// cout << "\\";
|
||||
// cout.flush();
|
||||
read += socket->read_some(boost::asio::buffer((char*)_to + read, _bytes - read), error);
|
||||
}
|
||||
while (toRead > 0);
|
||||
while (read < _bytes);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue