Fixed multiprocess port re-use on windows
This commit is contained in:
parent
9cfc3a9f85
commit
adfcfa99a1
|
@ -75,16 +75,8 @@ class Process(RemoteEventHandler):
|
||||||
|
|
||||||
#print "key:", ' '.join([str(ord(x)) for x in authkey])
|
#print "key:", ' '.join([str(ord(x)) for x in authkey])
|
||||||
## Listen for connection from remote process (and find free port number)
|
## Listen for connection from remote process (and find free port number)
|
||||||
port = 10000
|
l = multiprocessing.connection.Listener(('localhost', 0), authkey=authkey)
|
||||||
while True:
|
port = l.address[1]
|
||||||
try:
|
|
||||||
l = multiprocessing.connection.Listener(('localhost', int(port)), authkey=authkey)
|
|
||||||
break
|
|
||||||
except socket.error as ex:
|
|
||||||
if ex.errno != 98 and ex.errno != 10048: # unix=98, win=10048
|
|
||||||
raise
|
|
||||||
port += 1
|
|
||||||
|
|
||||||
|
|
||||||
## start remote process, instruct it to run target function
|
## start remote process, instruct it to run target function
|
||||||
sysPath = sys.path if copySysPath else None
|
sysPath = sys.path if copySysPath else None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user