| 7 | { |
| 8 | public: |
| 9 | EchoServer(EventLoop *loop, const InetAddress &addr, const std::string &name) |
| 10 | : server_(loop, addr, name) |
| 11 | , loop_(loop) |
| 12 | { |
| 13 | // 注册回调函数 |
| 14 | server_.setConnectionCallback( |
| 15 | std::bind(&EchoServer::onConnection, this, std::placeholders::_1)); |
| 16 | |
| 17 | server_.setMessageCallback( |
| 18 | std::bind(&EchoServer::onMessage, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); |
| 19 | |
| 20 | // 设置合适的subloop线程数量 |
| 21 | // server_.setThreadNum(3); |
| 22 | } |
| 23 | |
| 24 | void start() |
| 25 | { |
nothing calls this directly
no test coverage detected