1 #include <sys/socket.h>
8 #ifndef SO_MAX_PACING_RATE
9 #define SO_MAX_PACING_RATE 47
12 UDPStream::UDPStream(const sockaddr_in6 &dst, uint32_t pacing_rate)
14 pacing_rate(pacing_rate)
16 sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
18 // Oops. Ignore this output, then.
23 if (setsockopt(sock, SOL_SOCKET, SO_MAX_PACING_RATE, &pacing_rate, sizeof(pacing_rate)) == -1) {
24 if (pacing_rate != ~0U) {
25 log_perror("setsockopt(SO_MAX_PACING_RATE)");
30 UDPStream::~UDPStream()
37 void UDPStream::send(const char *data, size_t bytes)
42 ssize_t err = sendto(sock, data, bytes, 0, reinterpret_cast<sockaddr *>(&dst), sizeof(dst));