mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Set SO_REUSEADDR when determining socket availability
The old perl DS code for detection didn't set this so was often confused about port availability. We had to match their behavior so the installation didn't blow up. They fixed this a while ago, this catches us up.
This commit is contained in:
parent
2f50668753
commit
6d35812252
@ -183,6 +183,7 @@ def port_available(port):
|
||||
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
fcntl.fcntl(s, fcntl.F_SETFD, fcntl.FD_CLOEXEC)
|
||||
s.bind(('', port))
|
||||
s.close()
|
||||
@ -193,6 +194,7 @@ def port_available(port):
|
||||
if rv:
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
fcntl.fcntl(s, fcntl.F_SETFD, fcntl.FD_CLOEXEC)
|
||||
s.bind(('', port))
|
||||
s.close()
|
||||
|
Loading…
Reference in New Issue
Block a user