https://bugs.openldap.org/show_bug.cgi?id=10023
--- Comment #3 from ipuleston@sonicwall.com ipuleston@sonicwall.com --- Sorry, saved the above comment before I had completed it. To continue...
I prefer option #1 because it makes the connect properly function asynchronously when using TLS, but it will affect the fix for ITS #8957 and the reporter of that may have to do some extra coding (I have added them as a cc).
Option #2 fixes my reported issue without affecting that fix, but leaving it doing a synchronous connect when LDAP_OPT_X_TLS_HARD is set along with LDAP_OPT_CONNECT_ASYNC.
I don't actually use LDAP_OPT_X_TLS_HARD in my code (I start TLS from outside of the OpenLDAP code after waiting for the connect to complete) so either one will work for me.