Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void sessionHandleWrite(SessionSharedPtr ptr, const boost::system::error_code& error)
- {
- if (error)
- {
- ptr->disconnect();
- }
- else
- {
- ptr->mIsWritting = false;
- assert(!ptr->mIsWritting);
- ptr->writeNext();
- }
- }
- void Session::writeNext()
- {
- if (mIsWritting || !mPacketsToBeSend.pop(mSendingPacket))
- {
- return;
- }
- assert(!mIsWritting);
- mIsWritting = true;
- assert(mIsWritting);
- asio::async_write(mSocket, asio::buffer(mSendingPacket.data(), mSendingPacket.size()),
- boost::bind(sessionHandleWrite, shared_from_this(), asio::placeholders::error));
- }
Advertisement
Add Comment
Please, Sign In to add comment