mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-31 01:26:14 +01:00
Reduce the size of the window between opening a socket and setting it uninheritable.
This commit is contained in:
parent
7af2683b7d
commit
e432dc6104
1 changed files with 3 additions and 3 deletions
|
|
@ -130,17 +130,17 @@ def run(self):
|
|||
getattr(self.driver, 'listen_socket', None) is not None:
|
||||
ans = select.select((self.driver.listen_socket,), (), (), 0)
|
||||
if len(ans[0]) > 0:
|
||||
# timeout in 10 ms to detect rare case where the socket went
|
||||
# way between the select and the accept
|
||||
# timeout in 10 ms to detect rare case where the socket goes
|
||||
# away between the select and the accept
|
||||
try:
|
||||
self.driver._debug('attempt to open device socket')
|
||||
device_socket = None
|
||||
self.driver.listen_socket.settimeout(0.010)
|
||||
device_socket, ign = eintr_retry_call(
|
||||
self.driver.listen_socket.accept)
|
||||
set_socket_inherit(device_socket, False)
|
||||
self.driver.listen_socket.settimeout(None)
|
||||
device_socket.settimeout(None)
|
||||
set_socket_inherit(device_socket, False)
|
||||
|
||||
try:
|
||||
self.driver.connection_queue.put_nowait(device_socket)
|
||||
|
|
|
|||
Loading…
Reference in a new issue