On Wed, Nov 24, 2010 at 11:23:04AM -0700, Steven Dake wrote:
> The RCVBUF for the incoming socket is increased to 256k to prevent buffer
> overflows. The SNDBUF for the output sockets are increased to 256k to prevent
> buffer overflos.
>
> Signed-off-by: Steven Dake <[email protected]>
> ---
> exec/totemudpu.c | 22 ++++++++++++++++++++++
> 1 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/exec/totemudpu.c b/exec/totemudpu.c
> index dc74510..1a26099 100644
> --- a/exec/totemudpu.c
> +++ b/exec/totemudpu.c
> @@ -1317,6 +1317,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
> @@ -1368,6 +1370,14 @@ 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;
> + setsockopt (instance->token_socket, SOL_SOCKET, SO_RCVBUF,
> + &recvbuf_size, optlen);
how about:
res =setsockopt(..);
if (res == -1) {
// a useful message
return -1;
}
> +
> return 0;
> }
>
> @@ -1379,6 +1389,8 @@ static int totemudpu_build_sockets (
> int interface_num;
> int interface_up;
> int res;
> + unsigned int recvbuf_size;
> + unsigned int optlen = sizeof (recvbuf_size);
are these used? ^^
>
> /*
> * Determine the ip address bound to and the interface name
> @@ -1695,6 +1707,8 @@ int totemudpu_member_add (
> struct totemudpu_member *new_member;
> int res;
> char error_str[100];
> + unsigned int sendbuf_size;
> + unsigned int optlen = sizeof (sendbuf_size);
>
> new_member = malloc (sizeof (struct totemudpu_member));
> if (new_member == NULL) {
> @@ -1718,6 +1732,14 @@ 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;
> + setsockopt (new_member->fd, SOL_SOCKET, SO_SNDBUF,
> + &sendbuf_size, optlen);
same comment as above
-Angus
> return (0);
> }
>
> --
> 1.7.2.3
>
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais