[RFC wayland 12/18] os: Add a wl_os_socket_reuseaddr
Derek Foreman
derekf at osg.samsung.com
Tue Feb 9 16:55:59 UTC 2016
When we have tcp/ip listening sockets we want them to be reusable so we
don't get stuck with a timeout when restarting the compositor.
Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
src/wayland-os.c | 8 ++++++++
src/wayland-os.h | 3 +++
2 files changed, 11 insertions(+)
diff --git a/src/wayland-os.c b/src/wayland-os.c
index 4c6ffa7..876a552 100644
--- a/src/wayland-os.c
+++ b/src/wayland-os.c
@@ -74,6 +74,14 @@ wl_os_socket_cloexec(int domain, int type, int protocol)
return wl_os_set_cloexec_or_close(fd);
}
+void
+wl_os_socket_reuseaddr(int fd)
+{
+ int on = 1;
+
+ setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(int));
+}
+
int
wl_os_dupfd_cloexec(int fd, long minfd)
{
diff --git a/src/wayland-os.h b/src/wayland-os.h
index 9679214..a4a2234 100644
--- a/src/wayland-os.h
+++ b/src/wayland-os.h
@@ -34,6 +34,9 @@ wl_os_set_cloexec_or_close(int fd);
int
wl_os_socket_cloexec(int domain, int type, int protocol);
+void
+wl_os_socket_reuseaddr(int fd);
+
int
wl_os_dupfd_cloexec(int fd, long minfd);
--
2.7.0
More information about the wayland-devel
mailing list