mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-22 11:53:27 +02:00
Fix job server on some versions of windows using invalid pipe address
This commit is contained in:
parent
9ff677f415
commit
f054a3ea0c
1 changed files with 7 additions and 2 deletions
|
|
@ -10,13 +10,14 @@
|
|||
from math import ceil
|
||||
from threading import Thread, RLock
|
||||
from Queue import Queue, Empty
|
||||
from multiprocessing.connection import Listener
|
||||
from multiprocessing.connection import Listener, arbitrary_address
|
||||
from collections import deque
|
||||
from binascii import hexlify
|
||||
|
||||
from calibre.utils.ipc.launch import Worker
|
||||
from calibre.utils.ipc.worker import PARALLEL_FUNCS
|
||||
from calibre import detect_ncpus as cpu_count
|
||||
from calibre.constants import iswindows
|
||||
|
||||
_counter = 0
|
||||
|
||||
|
|
@ -91,7 +92,11 @@ def __init__(self, notify_on_job_done=lambda x: x, pool_size=None):
|
|||
self.pool_size = cpu_count() if pool_size is None else pool_size
|
||||
self.notify_on_job_done = notify_on_job_done
|
||||
self.auth_key = os.urandom(32)
|
||||
self.listener = Listener(authkey=self.auth_key, backlog=4)
|
||||
self.address = arbitrary_address('AF_PIPE' if iswindows else 'AF_UNIX')
|
||||
if iswindows and self.address[1] == ':':
|
||||
self.address = self.address[2:]
|
||||
self.listener = Listener(address=self.address,
|
||||
authkey=self.auth_key, backlog=4)
|
||||
self.add_jobs_queue, self.changed_jobs_queue = Queue(), Queue()
|
||||
self.kill_queue = Queue()
|
||||
self.waiting_jobs, self.processing_jobs = deque(), deque()
|
||||
|
|
|
|||
Loading…
Reference in a new issue