3#include "imr/mold/retransmission_buffer.h"
4#include "imr/util/file_descriptor.h"
5#include "imr/util/zstring_view.h"
6#include "imr/mold/packet_builder.h"
10#include <netinet/in.h>
11#include <sys/socket.h>
29
30
31
32
33
34
35
36
39 std::span<
const char> file,
43
44
52
53
54 std::array<epoll_event, 2> epoll_events_{};
59 std::span<
const char> file_;
62 void handle_request(
int client_fd);
65 sockaddr_in client_address;
68 std::size_t file_position_for_retransmission;
70 std::optional<RequestContext> parse_request(sockaddr_in&& client_addr);
72 void build_packet(
const RequestContext& ctx);
74 void send_packet(
const sockaddr_in& client_address);
76 void configure_socket(
const Config& cfg);
Builds MoldUDP64 packets.
Definition packet_builder.h:24
Retransmission buffer of the last buffer_size messages.
Definition retransmission_buffer.h:15
MoldUDP64 retransmission server.
Definition feed.h:18
void start()
Runs the event loop, blocking until shutdown_fd becomes readable.
Feed(const Config &cfg, const PacketBuilder::Config &packet_builder_cfg, std::span< const char > file, const RetransmissionBuffer &retransmission_buffer, int shutdown_fd)
Constructs and binds the retransmission socket.
RAII file descriptor wrapper.
Definition file_descriptor.h:19
A wrapper around std::string_view that guarantees null terminated strings for passing to C APIs.
Definition zstring_view.h:10
Definition file_descriptor.h:11
Definition packet_builder.h:30
util::zstring_view address
Address to bind the retransmission socket to.
Definition feed.h:24
std::uint16_t port
Port to bind to. Pass 0 to let the OS assign an ephemeral port.
Definition feed.h:26