Changeset 1953
- Timestamp:
- 04/26/08 19:31:35
- Files:
-
- trunk/cherrypy/process/servers.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/process/servers.py
r1938 r1953 164 164 return server_host 165 165 166 def check_port(host, port ):166 def check_port(host, port, timeout=1.0): 167 167 """Raise an error if the given port is not free on the given host.""" 168 168 if not host: … … 181 181 # See http://groups.google.com/group/cherrypy-users/ 182 182 # browse_frm/thread/bbfe5eb39c904fe0 183 s.settimeout( 1.0)183 s.settimeout(timeout) 184 184 s.connect((host, port)) 185 185 s.close() … … 198 198 for trial in xrange(50): 199 199 try: 200 check_port(host, port) 200 # we are expecting a free port, so reduce the timeout 201 check_port(host, port, timeout=0.1) 201 202 except IOError: 202 203 # Give the old server thread time to free the port. 203 time.sleep( .1)204 time.sleep(0.1) 204 205 else: 205 206 return

