How xinhai12310/muduo works
Muduo is a multithreaded C++ networking library built around a reactor. Its core workflow is to accept or initiate TCP connections, process I/O through event loops, and expose callbacks and buffers to application protocols. Major branches include HTTP and inspection, protobuf RPC, and optional Thrift and Redis integrations. The graph also shows the base logging and threading layer. Some runtime wiring is based on explicit README or source-index references; where the excerpts do not establish a call, the edge is omitted or marked unverified.
Main entry points: TcpClient.cc TCP client · EventLoop.cc Event loop · TcpConnection.cc TCP connection · Inspector.cc Inspector
Components 28
Reactor and TCP
- TCP client
muduo/net/TcpClient.cc - Connection dialer
muduo/net/Connector.cc - TCP server
muduo/net/TcpServer.h - TCP connection
muduo/net/TcpConnection.cc - Event loop
muduo/net/EventLoop.cc - I/O channel
muduo/net/Channel.cc - Poller
muduo/net/poller/EPollPoller.cc - Network buffer
muduo/net/Buffer.cc - Timer queue
muduo/net/TimerQueue.cc
Protocols and RPC
- HTTP parser
muduo/net/http/HttpContext.cc - HTTP request
muduo/net/http/HttpRequest.h - HTTP response
muduo/net/http/HttpResponse.cc - HTTP server
muduo/net/http/HttpServer.cc - Inspector
muduo/net/inspect/Inspector.cc - Process inspector
muduo/net/inspect/ProcessInspector.cc - Performance inspector
muduo/net/inspect/PerformanceInspector.cc - System inspector
muduo/net/inspect/SystemInspector.cc - Protobuf codec
muduo/net/protobuf/ProtobufCodecLite.cc - RPC channel
muduo/net/protorpc/RpcChannel.cc - RPC server
muduo/net/protorpc/RpcServer.cc
External Integrations
- Thrift server
contrib/thrift/ThriftServer.h - Thrift connection
contrib/thrift/ThriftConnection.cc - Redis client
contrib/hiredis/Hiredis.cc
Base Utilities
- Logging
muduo/base/Logging.h - Log stream
muduo/base/LogStream.cc - Thread pool
muduo/base/ThreadPool.cc
Other components
- Application
- Redis service
Connections 26
- Application → TCP client: initiates connection
README - Application → TCP server: serves TCP
README - TCP client → Connection dialer: creates
muduo/net/TcpClient.cc - TCP client → Event loop: schedules callbacks
muduo/net/TcpClient.cc - TCP client → TCP connection: creates
muduo/net/TcpClient.cc - Event loop → I/O channel: dispatches I/O
- Poller → I/O channel: polls channels
muduo/net/poller/EPollPoller.cc - TCP connection → Network buffer: uses
- Event loop → Timer queue: schedules timers
- HTTP parser → Network buffer: parses from
muduo/net/http/HttpContext.cc - HTTP parser → HTTP request: populates
- HTTP server → HTTP parser: parses requests
- HTTP server → HTTP response: sends responses
- Inspector → Process inspector: delegates to
muduo/net/inspect/Inspector.cc - Inspector → Performance inspector: delegates to
muduo/net/inspect/Inspector.cc - Inspector → System inspector: delegates to
muduo/net/inspect/Inspector.cc - Protobuf codec → TCP connection: encodes messages on
muduo/net/protobuf/ProtobufCodecLite.cc - RPC channel → Protobuf codec: uses codec
- Thrift server → TCP server: wraps
contrib/thrift/ThriftServer.h - Thrift connection → TCP connection: processes frames from
- Thrift connection → Thrift server: uses server
contrib/thrift/ThriftConnection.cc - Redis client → Event loop: integrates with
contrib/hiredis/Hiredis.cc - Redis client → I/O channel: registers I/O
contrib/hiredis/Hiredis.cc - Redis client → Redis service: issues commands
- Logging → Log stream: formats through
muduo/base/Logging.h - Thrift server → Thread pool: uses workers