mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix exception when attempting to select on a closed socket
This commit is contained in:
parent
656a28986e
commit
11731fd030
@ -447,13 +447,13 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
||||
if self.is_connected:
|
||||
self.noop_counter += 1
|
||||
if only_presence and (self.noop_counter % 5) != 1:
|
||||
try:
|
||||
ans = select.select((self.device_socket,), (), (), 0)
|
||||
if len(ans[0]) == 0:
|
||||
return (True, self)
|
||||
# The socket indicates that something is there. Given the
|
||||
# protocol, this can only be a disconnect notification. Fall
|
||||
# through and actually try to talk to the client.
|
||||
try:
|
||||
# This will usually toss an exception if the socket is gone.
|
||||
if self._call_client('NOOP', dict())[0] is None:
|
||||
self.is_connected = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user