完善实例代码

This commit is contained in:
xiongziliang 2018-09-27 09:20:29 +08:00
parent 21acda1e42
commit 223371ab5d

View File

@ -308,9 +308,17 @@ private:
*/ */
class EchoSession : public TcpSession { class EchoSession : public TcpSession {
public: public:
EchoSession(const std::shared_ptr<ThreadPool> &pTh, const Socket::Ptr &pSock) : TcpSession(pTh,pSock){}; EchoSession(const std::shared_ptr<ThreadPool> &pTh, const Socket::Ptr &pSock) :
virtual ~EchoSession(){}; TcpSession(pTh,pSock){
DebugL;
}
virtual ~EchoSession(){
DebugL;
}
void attachServer(const TcpServer &server) override{
DebugL << getIdentifier() << " " << TcpSession::getIdentifier();
}
void onRecv(const Buffer::Ptr &buffer) override { void onRecv(const Buffer::Ptr &buffer) override {
send(buffer); send(buffer);
} }