mirror of
https://github.com/openbsd/xenocara.git
synced 2025-12-09 02:39:00 +00:00
Make sure the socket send buffer is at least 64KB. This reduces the number of
writev(2) system calls made for largish requests. A similar change was made to the libxtrans code a while ago. This should speed up applications that send images to the X server, like Firefox. The seedupmight not be noticable though. But it reduces the noice in ktrace logs. ok matthieu@
This commit is contained in:
7
dist/libxcb/src/xcb_util.c
vendored
7
dist/libxcb/src/xcb_util.c
vendored
@@ -428,6 +428,8 @@ static int _xcb_open_unix(char *protocol, const char *file)
|
||||
{
|
||||
int fd;
|
||||
struct sockaddr_un addr;
|
||||
socklen_t len = sizeof(int);
|
||||
int val;
|
||||
|
||||
if (protocol && strcmp("unix",protocol))
|
||||
return -1;
|
||||
@@ -440,6 +442,11 @@ static int _xcb_open_unix(char *protocol, const char *file)
|
||||
fd = _xcb_socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if(fd == -1)
|
||||
return -1;
|
||||
if(getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) == 0 && val < 64 * 1024)
|
||||
{
|
||||
val = 64 * 1024;
|
||||
setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, sizeof(int));
|
||||
}
|
||||
if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
|
||||
close(fd);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user