Bouni / python-luxtronik

python-luxtronik is a library that allow you to interact with a Luxtronik heatpump controller.
MIT License
37 stars 19 forks source link

socket.recv() waits infinite when the connection is lost #165

Open Guzz-T opened 6 months ago

Guzz-T commented 6 months ago

If the connection is already established, a new call to read() will never finished in case the connection to the heat pump is lost inbetween.

It seems to resume if the heat pump is available again.

Is this a bug or a feature?

gerw commented 6 months ago

We could set _socket.setdefaulttimeout() to a sensible value, e.g., 5 seconds.

What shall we do when the timeout occurs? Raise an error? Try to reconnect?

Guzz-T commented 6 months ago

Normally I would close the socket and return the error status using the return parameter. The user then has to handle the error.

But that's almost like an "API change".