Signed-off-by: Fabio M. Di Nitto <[email protected]>

On 12/1/2010 5:28 PM, Steven Dake wrote:
> 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.
> 
> Signed-off-by: Steven Dake <[email protected]>
> ---
>  exec/totemudpu.c |   31 +++++++++++++++++++++++++++++++
>  1 files changed, 31 insertions(+), 0 deletions(-)
> 
> diff --git a/exec/totemudpu.c b/exec/totemudpu.c
> index 62b4d41..3fad618 100644
> --- a/exec/totemudpu.c
> +++ b/exec/totemudpu.c
> @@ -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);
>  }
>  

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to