Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions deluge_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ class RemoteException(DelugeClientException):


class DelugeRPCClient(object):
timeout = 20

def __init__(self, host, port, username, password, decode_utf8=False, automatic_reconnect=True):
def __init__(self, host, port, username, password, decode_utf8=False, automatic_reconnect=True, timeout=20):
self.host = host
self.port = port
self.username = username
self.password = password
self.deluge_version = None
self.timeout = timeout
# This is only applicable if deluge_version is 2
self.deluge_protocol_version = None

Expand Down Expand Up @@ -173,6 +172,9 @@ def _receive_response(self, deluge_version, protocol_version, partial_data=b''):
except ssl.SSLError:
raise CallTimeoutException()

if len(d) == 0:
raise ConnectionLostException()

data += d
if deluge_version == 2:
if expected_bytes is None:
Expand Down