Skip to content

Commit

Permalink
Handle socket not having attribute SO_REUSEPORT
Browse files Browse the repository at this point in the history
  • Loading branch information
kirubakaran committed Aug 31, 2016
1 parent 0095bcf commit e0cbcb0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gunicorn/sock.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def set_options(self, sock, bound=False):
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
try:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
except socket.error as e:
if e.errno == errno.ENOPROTOOPT:
except (AttributeError, socket.error) as e:
if isinstance(e, AttributeError) or e.errno == errno.ENOPROTOOPT:
self.log.warning('SO_REUSEPORT socket option not supported.')
if not bound:
self.bind(sock)
Expand Down

0 comments on commit e0cbcb0

Please # to comment.