[PATCH libxtrans] Increase UNIX socket buffer size
Hans de Goede
hdegoede at redhat.com
Mon Mar 31 03:41:17 PDT 2014
Hi,
On 03/29/2014 11:51 PM, Mark Kettenis wrote:
> From: Mark Kettenis <kettenis at openbsd.org>
>
> Some systems provide a really small default buffer size for UNIX sockets.
> Bump it up to 64k if necessary such that large transfers (such as
> XGetImage() on a 8-megapixel image) don't take tens of seconds.
Thanks,
I've pushed this to the libxtrans git repo, and it will be included
in the 1.3.4 release I'm about to do.
Regards,
Hans
> ---
> Xtranssock.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/Xtranssock.c b/Xtranssock.c
> index fdf1dd7..6cde146 100644
> --- a/Xtranssock.c
> +++ b/Xtranssock.c
> @@ -445,6 +445,27 @@ TRANS(SocketOpen) (int i, int type)
> }
> #endif
>
> + /*
> + * Some systems provide a really small default buffer size for
> + * UNIX sockets. Bump it up a bit such that large transfers don't
> + * proceed at glacial speed.
> + */
> +#ifdef SO_SNDBUF
> + if (Sockettrans2devtab[i].family == AF_UNIX)
> + {
> + SOCKLEN_T len = sizeof (int);
> + int val;
> +
> + if (getsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF,
> + (char *) &val, &len) == 0 && val < 64 * 1024)
> + {
> + val = 64 * 1024;
> + setsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF,
> + (char *) &val, sizeof (int));
> + }
> + }
> +#endif
> +
> return ciptr;
> }
>
>
More information about the xorg-devel
mailing list