summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/installutils.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-04-29 17:33:18 -0400
committerJason Gerard DeRose <jderose@redhat.com>2010-05-03 13:40:54 -0600
commit6d35812252cb4fcf34cf13bf88cbb705560afc3a (patch)
tree70862393ccf3b5556d17c9a0aac422a47eeea034 /ipaserver/install/installutils.py
parent2f50668753c77e599e0cef58c85baaa019264e5b (diff)
downloadfreeipa-6d35812252cb4fcf34cf13bf88cbb705560afc3a.tar.gz
freeipa-6d35812252cb4fcf34cf13bf88cbb705560afc3a.tar.xz
freeipa-6d35812252cb4fcf34cf13bf88cbb705560afc3a.zip
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.
Diffstat (limited to 'ipaserver/install/installutils.py')
-rw-r--r--ipaserver/install/installutils.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index 54d8df32a..5049962b9 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -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()