mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2026-01-20 14:41:54 +00:00
Set the max buffer size for sockets
Set the recv buffer to a large size and the send buffer to a large size to allow the kernel to store more messages before dropping messages. Amended to change optlen type to socklen_t Signed-off-by: Steven Dake <sdake@redhat.com> Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
This commit is contained in:
parent
00e340d095
commit
9096c4d96b
@ -1303,6 +1303,8 @@ static int totemudpu_build_sockets_ip (
|
||||
int addrlen;
|
||||
int res;
|
||||
int flag;
|
||||
unsigned int recvbuf_size;
|
||||
unsigned int optlen = sizeof (recvbuf_size);
|
||||
|
||||
/*
|
||||
* Setup unicast socket
|
||||
@ -1354,6 +1356,20 @@ static int totemudpu_build_sockets_ip (
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* the token_socket can receive many messages. Allow a large number
|
||||
* of receive messages on this socket
|
||||
*/
|
||||
recvbuf_size = MCAST_SOCKET_BUFFER_SIZE;
|
||||
res = setsockopt (instance->token_socket, SOL_SOCKET, SO_RCVBUF,
|
||||
&recvbuf_size, optlen);
|
||||
if (res == -1) {
|
||||
char error_str[100];
|
||||
strerror_r (errno, error_str, 100);
|
||||
log_printf (instance->totemudpu_log_level_notice,
|
||||
"Could not set recvbuf size %s\n", error_str);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1663,6 +1679,8 @@ int totemudpu_member_add (
|
||||
|
||||
struct totemudpu_member *new_member;
|
||||
int res;
|
||||
unsigned int sendbuf_size;
|
||||
unsigned int optlen = sizeof (sendbuf_size);
|
||||
char error_str[100];
|
||||
|
||||
new_member = malloc (sizeof (struct totemudpu_member));
|
||||
@ -1687,6 +1705,19 @@ int totemudpu_member_add (
|
||||
"Could not set non-blocking operation on token socket: %s\n", error_str);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* These sockets are used to send multicast messages, so their buffers
|
||||
* should be large
|
||||
*/
|
||||
sendbuf_size = MCAST_SOCKET_BUFFER_SIZE;
|
||||
res = setsockopt (new_member->fd, SOL_SOCKET, SO_SNDBUF,
|
||||
&sendbuf_size, optlen);
|
||||
if (res == -1) {
|
||||
strerror_r (errno, error_str, 100);
|
||||
log_printf (instance->totemudpu_log_level_notice,
|
||||
"Could not set sendbuf size %s\n", error_str);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user