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

Method onClientMessage

examples/multiplexer/multiplexer.cc:197–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195 }
196
197 void onClientMessage(const TcpConnectionPtr& conn, Buffer* buf, Timestamp)
198 {
199 size_t len = buf->readableBytes();
200 transferred_.addAndGet(len);
201 receivedMessages_.incrementAndGet();
202 if (!conn->getContext().empty())
203 {
204 int id = boost::any_cast<int>(conn->getContext());
205 sendBackendBuffer(id, buf);
206 // assert(buf->readableBytes() == 0);
207 }
208 else
209 {
210 buf->retrieveAll();
211 // FIXME: error handling
212 }
213 }
214
215 void onBackendConnection(const TcpConnectionPtr& conn)
216 {

Callers

nothing calls this directly

Calls 5

readableBytesMethod · 0.80
addAndGetMethod · 0.80
incrementAndGetMethod · 0.80
retrieveAllMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected