summaryrefslogtreecommitdiff
path: root/cherrypy/process
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2017-10-28 08:43:27 -0400
committerJason R. Coombs <jaraco@jaraco.com>2017-10-28 08:43:27 -0400
commitfb4fd8e9e2299fae158a0739085ef2b3a656cde0 (patch)
treecc8651b2322ef8d454d25ffc125f3069b5813d57 /cherrypy/process
parent3d7f6780c1912d9f495b3d273836cf2f0f975ad1 (diff)
downloadcherrypy-git-fb4fd8e9e2299fae158a0739085ef2b3a656cde0.tar.gz
Use short-circuits and reindent to allow the single-line invocation of portend.occupied, required by older Pythons.
Diffstat (limited to 'cherrypy/process')
-rw-r--r--cherrypy/process/servers.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/cherrypy/process/servers.py b/cherrypy/process/servers.py
index 605c6f69..67908575 100644
--- a/cherrypy/process/servers.py
+++ b/cherrypy/process/servers.py
@@ -247,15 +247,16 @@ class ServerAdapter(object):
time.sleep(.1)
# Wait for port to be occupied
- if not os.environ.get('LISTEN_PID', None):
- # Wait for port to be occupied if not running via socket-activation
- # (for socket-activation the port will be managed by systemd )
- if isinstance(self.bind_addr, tuple):
- with _safe_wait(*self.bound_addr):
- portend.occupied(
- *self.bound_addr,
- timeout=Timeouts.occupied,
- )
+ if os.environ.get('LISTEN_PID', None):
+ return
+
+ # Wait for port to be occupied if not running via socket-activation
+ # (for socket-activation the port will be managed by systemd )
+ if not isinstance(self.bind_addr, tuple):
+ return
+
+ with _safe_wait(*self.bound_addr):
+ portend.occupied(*self.bound_addr, timeout=Timeouts.occupied)
@property
def bound_addr(self):