This sets the receive and send transmission buffers to a larger size to avoid overruns

of the multicast buffer.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@799 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Steven Dake 2005-08-18 19:53:20 +00:00
parent 0e50278a32
commit 11f15dabc1

View File

@ -1,4 +1,3 @@
#define WORKER_THREAD_COUNT 2
/*
* Copyright (c) 2005 MontaVista Software, Inc.
*
@ -71,6 +70,8 @@
#include "crypto.h"
#define MCAST_SOCKET_BUFFER_SIZE (16 * 9000) /* where 16 is the transmits allowed, 9000 is mtu size */
#define NETIF_STATE_REPORT_UP 1
#define NETIF_STATE_REPORT_DOWN 2
@ -961,6 +962,9 @@ static int totemnet_build_sockets (
struct sockaddr_in sockaddr_in_test;
char flag;
int res;
unsigned int sendbuf_size;
unsigned int recvbuf_size;
unsigned int optlen = sizeof (sendbuf_size);
memset (&mreq, 0, sizeof (struct ip_mreq));
@ -996,6 +1000,26 @@ static int totemnet_build_sockets (
instance->totemnet_log_printf (instance->totemnet_log_level_warning, "Could not bind to device for multicast, group messaging may not work properly. (%s)\n", strerror (errno));
}
recvbuf_size = MCAST_SOCKET_BUFFER_SIZE;
sendbuf_size = MCAST_SOCKET_BUFFER_SIZE;
/*
* Set buffer sizes to avoid overruns
*/
res = setsockopt (sockets->mcast, SOL_SOCKET, SO_RCVBUF, &recvbuf_size, optlen);
res = setsockopt (sockets->mcast, SOL_SOCKET, SO_SNDBUF, &sendbuf_size, optlen);
res = getsockopt (sockets->mcast, SOL_SOCKET, SO_RCVBUF, &recvbuf_size, &optlen);
if (res == 0) {
instance->totemnet_log_printf (instance->totemnet_log_level_notice,
"Multicast socket recv buffer size (%d bytes).\n", recvbuf_size);
}
res = getsockopt (sockets->mcast, SOL_SOCKET, SO_SNDBUF, &sendbuf_size, &optlen);
if (res == 0) {
instance->totemnet_log_printf (instance->totemnet_log_level_notice,
"Multicast socket send buffer size (%d bytes).\n", sendbuf_size);
}
/*
* Bind to multicast socket used for multicast send/receives
*/