| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| @@ -1775,7 +1775,7 @@ cdef class Loop: | |||
| if reuse_address: | |||
| sock.setsockopt(uv.SOL_SOCKET, uv.SO_REUSEADDR, 1) | |||
There was a problem hiding this comment.
Isn't the same problem here with SO_REUSEADDR?
Sorry, something went wrong.
There was a problem hiding this comment.
No; the place to look is uvloop/includes/stdlib.pxi
cdef int has_IPV6_V6ONLY = hasattr(socket, 'IPV6_V6ONLY') cdef int IPV6_V6ONLY = getattr(socket, 'IPV6_V6ONLY', -1) cdef int has_SO_REUSEPORT = hasattr(socket, 'SO_REUSEPORT') cdef int SO_REUSEPORT = getattr(socket, 'SO_REUSEPORT', 0)
Note that there's a check to see if the variable exists, and then a python definition of the variable with a default, guaranteeing it's defined. This is how the code handles platforms that don't have the constants defined. For other constants (such as SO_REUSEADDR) there's neither a check nor a python definition of the constant.
Sorry, something went wrong.
There was a problem hiding this comment.
Let's also drop the definition of uv.SO_REUSEPORT to prevent future usage.
Sorry, something went wrong.
Changes ======= * Add cleanup_socket param on create_unix_server() (#623) (by @fantix in d6114d2) Fixes ===== * Use cythonized SO_REUSEPORT rather than the unwrapped native one. (#609) (by @ptribble in 4083a94 for #550) * UDP errors should result in protocol.error_received (#601) (by @jensbjorgensen in 3c3bbef) * Updates for Cython3 (#587) (by @alan-brooks in 3fba9fa for #587) * Test with Python 3.13 (#610) (by @edgarrmondragon in fb5a139)
| Back | FazBrowse Home | New Git URL |
The code already detects (via hasattr) whether SO_REUSEPORT is available, setting has_SO_REUSEPORT, and creates a wrapped SO_REUSEPORT (via getattr). This change ensures it's that wrapped SO_REUSEPORT that's used, rather than the native C version (which may not exist).
Fixes #550