MCPcopy Create free account
hub / github.com/Shangyizhou/A-Tiny-Network-Library / onConnection

Method onConnection

example/echoServer.cc:31–41  ·  view source on GitHub ↗

连接建立或断开的回调函数

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

toIpPortMethod · 0.80
connectedMethod · 0.45

Tested by

no test coverage detected