JohnDoee / deluge-client

A very lightweight pure-python Deluge RPC Client
MIT License
87 stars 14 forks source link

Detect broken connections / make timeout configurable #42

Closed dsander closed 6 months ago

dsander commented 3 years ago

Hi! 👋

I was trying to use the deluge integration of Home Assistant which uses this egg. I noticed that the deluge device in Home Assistant stayed unreachable after the deluge server was restarted. This happened because a broken connection was not detected and thus never reset.


Detect closed connections in _receive_response

When the connection to the deluge server was lost (the server was restarted or shut down), _receive_response was stuck in a infinite loop before. Since recv never returns any data the function never broke out of the while loop. Raising a ConnectionLostException ensures the retry logic can work as expected.


Make the socket timeout configurable

kslr commented 3 years ago

looks great.