From 4083a94e5c1c3ab681ffe0b2c0b60fba16540220 Mon Sep 17 00:00:00 2001 From: Peter Tribble Date: Fri, 16 Aug 2024 01:14:19 +0100 Subject: [PATCH] Use cythonized SO_REUSEPORT rather than the unwrapped native one. (#609) Fixes #550 Co-authored-by: Fantix King --- uvloop/includes/uv.pxd | 2 +- uvloop/loop.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/uvloop/includes/uv.pxd b/uvloop/includes/uv.pxd index 8765130..2756a30 100644 --- a/uvloop/includes/uv.pxd +++ b/uvloop/includes/uv.pxd @@ -57,7 +57,7 @@ cdef extern from "uv.h" nogil: cdef int SOL_SOCKET cdef int SO_ERROR cdef int SO_REUSEADDR - cdef int SO_REUSEPORT + # use has_SO_REUSEPORT and SO_REUSEPORT in stdlib.pxi instead cdef int AF_INET cdef int AF_INET6 cdef int AF_UNIX diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index 334d8d5..de88b57 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -1775,7 +1775,7 @@ cdef class Loop: if reuse_address: sock.setsockopt(uv.SOL_SOCKET, uv.SO_REUSEADDR, 1) if reuse_port: - sock.setsockopt(uv.SOL_SOCKET, uv.SO_REUSEPORT, 1) + sock.setsockopt(uv.SOL_SOCKET, SO_REUSEPORT, 1) # Disable IPv4/IPv6 dual stack support (enabled by # default on Linux) which makes a single socket # listen on both address families.