I looked deeper into the source, and i found the problem. Non-blocking socket seems to be implemented in starttls connection only, not in direct-SSL (ldaps://) which use a blocking socket.
The problem isn't openssl or gnutls related.
Another solution could be to set the socket timeout to a more reasonable value.
I would like to help more, but this kind of modification is too complicated for my actual knowledge of sockets.
Regards.