Handle correctly failures in OpenSSL connections

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>