Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 023426e

Browse filesBrowse files
Giovanni Hartingjstasiak
Giovanni Harting
authored andcommitted
Support kernel versions <3.9
added catch of OSError added catch of socket.error for python2
1 parent ddb1048 commit 023426e
Copy full SHA for 023426e

File tree

Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-1
lines changed

‎zeroconf.py

Copy file name to clipboardExpand all lines: zeroconf.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,12 +1295,18 @@ def new_socket():
12951295
# Volume 2"), but some BSD-derived systems require
12961296
# SO_REUSEPORT to be specified explicity. Also, not all
12971297
# versions of Python have SO_REUSEPORT available.
1298+
# Catch OSError and socket.error for kernel versions <3.9 because lacking
1299+
# SO_REUSEPORT support.
12981300
try:
12991301
reuseport = socket.SO_REUSEPORT
13001302
except AttributeError:
13011303
pass
13021304
else:
1303-
s.setsockopt(socket.SOL_SOCKET, reuseport, 1)
1305+
try:
1306+
s.setsockopt(socket.SOL_SOCKET, reuseport, 1)
1307+
except (OSError, socket.error) as err: # OSError on python 3, socket.error on python 2
1308+
if not err.errno == errno.ENOPROTOOPT:
1309+
raise
13041310

13051311
s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255)
13061312
s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_LOOP, 1)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.