lymph
lymph copied to clipboard
Actually disconnect on timeout
lymph.core.connection.Connection pings the endpoint regularly
to determine whether it is still live. __init__
takes a
unresponsive_disconnect
parameter, which was however ignored
so far. Similarly, the idle_disconnect
parameter did not have
any effect.
This commit uses thees two parameters to do what they advertise, i.e. close the connection once the respective timeouts have been reached.
To this end, the greenlet management logic was also changed, such
that the monitoring greenlets now commit suicide when the connection
status == CLOSED
instead of being explicitely killed from close()
.
Without this change, the monitoring greenlet would inadvertently kill
itself, leading to (very nonobvious) dead code and leaving a half-dead
connection object still registered with the server.
(edited as requested by @mouadino)