This case should be handled next with SSL_get_error() which will return SSL_ERROR_ZERO_RETURN.

extract from man SSL_read():
RETURN VALUES
 0   The read operation was not successful. The reason may either be a clean shutdown due to a "close notify" alert sent by
           the peer (in which case the SSL_RECEIVED_SHUTDOWN flag in the ssl shutdown state is set (see SSL_shutdown(3),
           SSL_set_shutdown(3)). It is also possible, that the peer simply shut down the underlying transport and the shutdown is
           incomplete. Call SSL_get_error() with the return value ret to find out, whether an error occurred or the connection was
           shut down cleanly (SSL_ERROR_ZERO_RETURN).