Exit when daemon is becoming dead

* Exit if handshake is timeouted
* Exit if daemon becomes unavailable
* Simplify overall code

Signed-off-by: Sergey Matveev <stargrave@stargrave.org>