parent
527e22ba5d
commit
75130719b5
@ -39,15 +39,18 @@ def _get_display_number():
|
|||||||
display_is_free = False
|
display_is_free = False
|
||||||
|
|
||||||
while not display_is_free and retries > 0:
|
while not display_is_free and retries > 0:
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
lockstr = "/tmp/.X%d-lock" % display_number
|
||||||
try:
|
if not os.path.exists(lockstr):
|
||||||
s.connect(('127.0.0.1', 6000 + display_number))
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
s.close()
|
try:
|
||||||
|
s.connect(('127.0.0.1', 6000 + display_number))
|
||||||
|
s.close()
|
||||||
|
except:
|
||||||
|
display_is_free = True
|
||||||
|
break
|
||||||
|
|
||||||
display_number += 1
|
display_number += 1
|
||||||
retries -= 1
|
retries -= 1
|
||||||
except:
|
|
||||||
display_is_free = True
|
|
||||||
|
|
||||||
if display_is_free:
|
if display_is_free:
|
||||||
log.info(
|
log.info(
|
||||||
|
Loading…
Reference in New Issue
Block a user