How syloe1/reactornet works
ReactorNet is a Linux C++ networking library. Its principal workflow accepts a client connection on a base reactor, assigns it to a worker loop, processes socket events and buffered data there, and invokes application callbacks to produce a response. The README also documents timer scheduling and an HTTP/1.1 static-file server with URL decoding and traversal protection. Core reactor and server wiring is supported by sampled source; HTTP handler details are based on README capabilities and the example path, whose source was not sampled.
Main entry points: EventLoop.cpp Event loop · TcpServer.cpp TCP server · TcpConnection.cpp TCP connection · http_server.cpp HTTP server example
Components 17
Server lifecycle
- TCP server
src/TcpServer.cpp - Acceptor
src/Acceptor.cpp - Loop threads
src/EventLoopThread.cpp
Reactor core
- Event loop
src/EventLoop.cpp - Epoll poller
src/EPollPoller.cpp - Event channel
src/Channel.cpp - Timer queue
src/TimerQueue.cpp - Timer callbacks
include/Timer.h
TCP connection
- TCP connection
src/TcpConnection.cpp - I/O buffer
src/Buffer.cpp - Socket wrapper
src/Socket.cpp - IP address
src/InetAddress.cpp
HTTP serving
- HTTP server example
example/http_server.cpp - HTTP request parser
src/HttpRequest.cpp - HTTP response builder
src/HttpResponse.cpp - Static documents
www/index.html
Other components
- TCP client
Connections 22
- TCP client → Acceptor: opens connection
- TCP server → Acceptor: configures accept
- Acceptor → TCP server: reports accepted socket
- TCP server → Loop threads: starts workers
- TCP server → TCP connection: creates connection
- TCP server → Event loop: dispatches connection
- TCP connection → Event loop: registers events
- Event loop → Epoll poller: polls events
- Epoll poller → Event loop: returns ready channels
- Event loop → Event channel: dispatches events
- Event channel → Event loop: updates interests
- TCP connection → I/O buffer: reads and writes
- TCP connection → Socket wrapper: owns socket
- TCP connection → IP address: stores endpoints
- Event loop → Timer queue: drives timers
- Timer queue → Timer callbacks: runs callbacks
- Timer queue → Event channel: registers timerfd
- HTTP server example → TCP server: configures server
- HTTP server example → HTTP request parser: parses requests
- HTTP server example → HTTP response builder: builds responses
- HTTP server example → Static documents: serves documents
- TCP client → HTTP server example: requests content