MCPcopy Create free account
hub / github.com/chenshuo/muduo / onConnection

Method onConnection

examples/asio/chat/server_threaded.cc:40–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38
39 private:
40 void onConnection(const TcpConnectionPtr& conn)
41 {
42 LOG_INFO << conn->peerAddress().toIpPort() << " -> "
43 << conn->localAddress().toIpPort() << " is "
44 << (conn->connected() ? "UP" : "DOWN");
45
46 MutexLockGuard lock(mutex_);
47 if (conn->connected())
48 {
49 connections_.insert(conn);
50 }
51 else
52 {
53 connections_.erase(conn);
54 }
55 }
56
57 void onStringMessage(const TcpConnectionPtr&,
58 const string& message,

Callers

nothing calls this directly

Calls 3

insertMethod · 0.80
toIpPortMethod · 0.45
connectedMethod · 0.45

Tested by

no test coverage detected