Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket: Allow to set UDP send buffer #95

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/netlog/netlog-network.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,13 @@ int manager_open_network_socket(Manager *m) {
r = setsockopt_int(m->socket, IPPROTO_IP, IP_MULTICAST_LOOP, true);
if (r < 0)
log_debug_errno(errno, "UDP: Failed to set IP_MULTICAST_LOOP: %m");
}

if (m->send_buffer > 0) {
r = fd_set_sndbuf(m->socket, m->send_buffer, false);
if (r < 0)
log_debug_errno(r, "UDP: SO_SNDBUF/SO_SNDBUFFORCE failed: %m");
}}

break;
case SYSLOG_TRANSMISSION_PROTOCOL_TCP: {
if (m->no_delay) {
Expand All @@ -424,7 +430,7 @@ int manager_open_network_socket(Manager *m) {
if (m->send_buffer > 0) {
r = fd_set_sndbuf(m->socket, m->send_buffer, false);
if (r < 0)
log_debug_errno(r, "SO_SNDBUF/SO_SNDBUFFORCE failed: %m");
log_debug_errno(r, "TCP: SO_SNDBUF/SO_SNDBUFFORCE failed: %m");
}

if (m->keep_alive) {
Expand Down