Skip to content

Commit

Permalink
socket: Allow to set UDP send buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
ssahani committed May 14, 2024
1 parent d97df91 commit 132259e
Showing 1 changed file with 8 additions and 2 deletions.
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

0 comments on commit 132259e

Please sign in to comment.