xTachyon

Untitled

Feb 1st, 2017
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. header:
  2.  
  3. class Session;
  4.  
  5. using SessionUniquePtr = std::unique_ptr<Session>;
  6. using SessionSharedPtr = std::shared_ptr<Session>;
  7.  
  8. class Session : public std::enable_shared_from_this<Session>
  9. {
  10. public:
  11.  
  12.   friend void sessionHandleRead(SessionSharedPtr ptr, const boost::system::error_code& error, bool header);
  13.   void readNext();
  14.   friend void sessionHandleWrite(SessionSharedPtr ptr, const boost::system::error_code& error);
  15.   void writeNext();
  16. };
  17.  
  18. source:
  19.  
  20. void Session::writeNext()
  21. {
  22.   if (mSendingPacket || mSendingQueue.empty()) return;
  23.  
  24.   mSendingPacket = mSendingQueue.pop();
  25.   if (!mSendingPacket) return;
  26.  
  27.   asio::async_write(mSocket, asio::buffer(mSendingPacket->data(), mSendingPacket->size()),
  28.                     boost::bind(sessionHandleWrite, shared_from_this(), asio::placeholders::error));
  29.                                     ^^^
  30.     // another things,
  31. }
  32.  
  33. void sessionHandleWrite(SessionSharedPtr ptr, const boost::system::error_code& error)
  34. {
  35.     // do things
  36. }
  37.  
  38. E:\Info\repos\RedstoneInside\src\session.cxx: In member function 'void redi::Session::writeNext()':
  39. E:\Info\repos\RedstoneInside\src\session.cxx:32:33: error: 'sessionHandleWrite' was not declared in this scope
  40.                      boost::bind(sessionHandleWrite, shared_from_this(), asio::placeholders::error));
Advertisement
Add Comment
Please, Sign In to add comment