mirror of
https://github.com/python/cpython.git
synced 2025-08-25 11:15:02 +00:00
bpo-40280: Disable AF_UNIX, AF_PACKET, SO_REUSE* on Emscripten (#31829)
Emscripten's socket emulation is limited. AF_UNIX, AF_PACKET, setsockopt(), and most SO_* constants are not supported.
This commit is contained in:
parent
3b128c0548
commit
ecfff63e06
4 changed files with 22 additions and 5 deletions
|
@ -465,9 +465,9 @@ class TCPServer(BaseServer):
|
|||
May be overridden.
|
||||
|
||||
"""
|
||||
if self.allow_reuse_address:
|
||||
if self.allow_reuse_address and hasattr(socket, "SO_REUSEADDR"):
|
||||
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
if self.allow_reuse_port:
|
||||
if self.allow_reuse_port and hasattr(socket, "SO_REUSEPORT"):
|
||||
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
|
||||
self.socket.bind(self.server_address)
|
||||
self.server_address = self.socket.getsockname()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue