连接建立或断开的回调函数
| 29 | private: |
| 30 | // 连接建立或断开的回调函数 |
| 31 | void onConnection(const TcpConnectionPtr &conn) |
| 32 | { |
| 33 | if (conn->connected()) |
| 34 | { |
| 35 | LOG_INFO << "Connection UP : " << conn->peerAddress().toIpPort().c_str(); |
| 36 | // LOG_INFO("Connection UP : %s", conn->peerAddress().toIpPort().c_str()); |
| 37 | } |
| 38 | else |
| 39 | { |
| 40 | LOG_INFO << "Connection DOWN : " << conn->peerAddress().toIpPort().c_str(); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | // 可读写事件回调 |
| 45 | void onMessage(const TcpConnectionPtr &conn, Buffer *buf, Timestamp time) |